-
1 votesanswersviews
在Android前台服务中增加startId有什么影响?
我'm using the foreground service in my android application. And i' m覆盖服务的方法 onStartCommand ,如下所示: public int onStartCommand(Intent intent, int flags, int startId) { // doing my staff here } 正如documen... -
0 votesanswersviews
前台服务通知按钮奇怪地工作重新启动活动(绑定到服务)
我有 MusicPlayerActivity (它的launchMode在Manifest中是SingleTop)和 MainActivity ,都绑定到 MusicService . 一切似乎都很好,但后来我看到了一个错误:播放第一首歌没有问题 . 但是,当我播放第二首歌曲,并尝试使用通知的按钮来控制它时,表现就好像按了两次 . 因此,暂停将导致再次播放,接下来将导致跳过一首歌曲 . What... -
0 votesanswersviews
AltBeacon库作为前台服务,在激活时会激活Activity元素
我正在使用最新的AltBeacon库并在MonitorActivity类中运行带有一些mod的参考应用程序,以及利用bootstrapping的前台服务功能 . 我的应用程序可以检测前台或服务中的信标,但是当我从服务到活动的Activity时,我正在努力(Android新手)使用Activities视觉元素 . 引导区域在Application类中创建,然后创建MonitorActivity . ... -
4 votesanswersviews
然后Context.startForegroundService()没有调用Service.startForeground
我的应用程序将在 MainActivity 的 onCreate 中调用 startForegroundService(intent) . 我把 startForeground(ON_SERVICE_CONNECTION_NID, notification) 放在了 onCreate 和 Service 的 Service 中 . 但我偶尔会收到这个错误 . Exception android.... -
5 votesanswersviews
Context.startForegroundService()然后没有调用Service.startForeground()?
我的用户报告了数百次崩溃,但仍然无法找到解决方法 . 这些崩溃来自Android 8(三星,华为,谷歌) . 我得到这两个崩溃: Fatal Exception: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground() ... -
21 votesanswersviews
奥利奥 - 前景服务不显示前景通知
到目前为止,我已经调整了我的代码以使用 ContextCompat.startForegroundService(context, intentService); 来启动我的服务 . 这样,它适用于android <26和android 26(Oreo) . 我仍然看到一个区别,在android oreo我没有看到我的自定义前景通知(我只看到“应用程序在后台运行”通知) . 我还需要调整任何... -
0 votesanswersviews
奥利奥,前台服务在关闭时停止
我使用服务作为前台服务 . 在Android前O版本一切正常 . 但是当我关闭应用程序的Android奥利奥时,前台服务也关闭了... 我在这里如何开始服务: val i = Intent(activity, MyService::class.java) ContextCompat.startForegroundService(activity, i) 而不是内部服务 onStart : val... -
0 votesanswersviews
Context.startForegroundService未启动服务
我正在尝试遵循新的Android O准则来启动位置更新的前台服务 . 当我调用 context.startForegroundService(foregroundIntent) 在服务类中没有任何反应时,甚至不会调用 onCreate() . 但是,应用程序继续运行没有任何错误 . 这是我的意图: val foregroundIntent = Intent(context, GeofenceFo... -
0 votesanswersviews
Android Oreo前台服务无法在Doze模式下运行
为了克服android OREO(targetSdkVersion 27)后台服务限制,我创建了一个带有Notification的前台服务 . 通知显示在通知栏中,到目前为止服务正在运行 . 我在前台服务类中使用FusedLocationClient将我的代码与活动识别和位置跟踪相关联 . 当手机处于活动状态或屏幕打开时,ActivityRecognition和位置跟踪正在按预期工作 . 但是当屏... -
0 votesanswersviews
关于在奥利奥的前台服务之间共享和重新创建相同通知的问题
我有一个Android应用程序,使用服务来收听位置更新 . 由于有关后台服务的新奥利奥政策,我正在更新应用程序以使用前台服务,以便操作系统不会破坏服务 . 我只是通过调用: @Override public int onStartCommand(Intent intent, int flags, int startId) { startForeground( No... -
2 votesanswersviews
奥利奥背景服务
在我们的应用程序中,我们使用多种服务和意图服务进行BLE通信,麦克风录音等 . 我们注意到了新的背景限制和限制(是的,我们确实注意到它已经很晚了,我知道) . 我已经更改了使用ContextCompat.startForegroundService()函数的实现,并使用startForeground()和docs中声明的通知 . 但我们看到,当应用程序是 killed 时,前台服务也会在几分钟后死... -
4 votesanswersviews
当应用程序在Android Pie上受到后台限制时启动前台服务
使用Android 9.0(Pie),用户可以限制您的应用程序通过设置进行后台工作 . 当我们尝试在Pie设备上启动前台服务时,如果应用程序受到后台限制,即使应用程序活动完全位于前台,我们的应用程序也会遇到以下异常 . RemoteServiceException: Context.startForegroundService() did not then call Service.startFo...