草庐IT

startforeground

全部标签

关于Context.startForegroundService() did not then call Service.startForeground()的解决办法

文章目录关于Context.startForegroundService()didnotthencallService.startForeground()的解决办法第一处:停止服务第二处:超时结论参考关于Context.startForegroundService()didnotthencallService.startForeground()的解决办法有天突然报了以下错误android.app.RemoteServiceException:Context.startForegroundService()didnotthencallService.startForeground()顺着这个提示

Android 9 (Pie), Context.startForegroundService() 没有调用 Service.startForeground() : ServiceRecord

首先,我看了这些;Context.startForegroundService()didnotthencallService.startForeground()Context.startForegroundService()didnotthencallService.startForegroundAndroid9(Pie)Only:Context.startForegroundService()didnotthencallService.startForeground()-WorksfineonOreoRemoteServiceExceptionContext.startForegro

android - 多次调用 startforeground?

我创建了一个发送电子邮件的服务(EmailService)...每次我需要用我的应用程序发送电子邮件时,它都会启动该服务并通过Intent传递电子邮件的ID...我正在使用startforeground(id_of_email,mynotifcation);来防止它被杀死并向用户显示电子邮件发送状态的通知。我需要允许用户同时发送多封电子邮件,所以当用户需要发送另一封电子邮件时,它会再次调用startservice并带有新的Intent(不同的电子邮件ID)...因此它再次调用startforeground(new_id_of_email,mynotifcation);。问题是对star

android - 使用 startForeground() 调用的多个前台服务的单个通知

我有一个包含两项服务的应用。一个是使用WindowManager显示在其他应用程序上float(覆盖)的UI。另一个是使用GooglePlayAPI进行位置跟踪。我的应用始终运行这些服务。我希望这些服务不会被操作系统杀死。所以我调用了Service.startForeground()。但是,通知抽屉中有两个通知。有没有办法对两种服务使用同一个通知? 最佳答案 是的,这是可能的。如果我们看一下Service.startForeground()签名,它接受通知ID和通知本身(seedocumentation)。因此,如果我们想为多个前台

Android 9 (Pie) 只有 : Context. startForegroundService() 然后没有调用 Service.startForeground() - 在 Oreo 上工作正常

我们调整了针对奥利奥的持续通知,效果很好。现在,仅在Pie上(不会在Oreo设备上发生),我们收到标题错误。Pie中的前台服务是否发生了我遗漏的某些更改?这是前台服务的onCreate代码->overridefunonCreate(){super.onCreate()valnotification:Notification=NotificationCompat.Builder(this,packageName).setSmallIcon(R.drawable.status_notification_icon).setContentTitle(getString(R.string.ong

android.app.RemoteServiceException: Bad notification for startForeground

异常如下:E/AndroidRuntime(22959):FATALEXCEPTION:mainE/AndroidRuntime(22959):Process:com.example.lota,PID:22959E/AndroidRuntime(22959):android.app.RemoteServiceException:BadnotificationforstartForegroundE/AndroidRuntime(22959): atandroid.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:

启动服务报错:Context.startForegroundService() did not then call Service.startForeground():

在Launcher(也可以是任何一个app)中启动其他app服务的时候报错AndroidRuntime:android.app.RemoteServiceException:Context.startForegroundService()didnotthencallService.startForeground():第一次使用在Launcher中使用startService(intent);启动其他app的服务,这样不能进入服务会出现APPinbackgroundinnulluidAndroid8.0对特定函数做出了以下变更:针对Android8.0的应用,在不允许其创建后台服务的情况下使用s

启动服务报错:Context.startForegroundService() did not then call Service.startForeground():

在Launcher(也可以是任何一个app)中启动其他app服务的时候报错AndroidRuntime:android.app.RemoteServiceException:Context.startForegroundService()didnotthencallService.startForeground():第一次使用在Launcher中使用startService(intent);启动其他app的服务,这样不能进入服务会出现APPinbackgroundinnulluidAndroid8.0对特定函数做出了以下变更:针对Android8.0的应用,在不允许其创建后台服务的情况下使用s

android - 如何防止我的 Android 应用程序/服务成为任务管理器的 "killed"?

让我的服务一直运行直到有密码的人从我的UI屏幕停止服务是非常重要的。我的应用程序运行良好,但它旨在由parent(使用密码)在child的手机上打开/关闭。我已经设法使一切正常,但我遇到的问题是,如果child使用任务管理器来终止我的服务,那么我的应用程序就没用了。我会感谢任何知道方法的人1)监控服务并在其“被杀死”时自动启动它或者2)防止有人能够杀死它,除了启动服务的Activity(管理屏幕)。还是两者兼有?对不起,如果我描述的问题不是很清楚,我是初学者。到目前为止,我已经取得了很大的进步,但我被困在了最后一个障碍上。 最佳答案

android - 如何防止我的 Android 应用程序/服务成为任务管理器的 "killed"?

让我的服务一直运行直到有密码的人从我的UI屏幕停止服务是非常重要的。我的应用程序运行良好,但它旨在由parent(使用密码)在child的手机上打开/关闭。我已经设法使一切正常,但我遇到的问题是,如果child使用任务管理器来终止我的服务,那么我的应用程序就没用了。我会感谢任何知道方法的人1)监控服务并在其“被杀死”时自动启动它或者2)防止有人能够杀死它,除了启动服务的Activity(管理屏幕)。还是两者兼有?对不起,如果我描述的问题不是很清楚,我是初学者。到目前为止,我已经取得了很大的进步,但我被困在了最后一个障碍上。 最佳答案