- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
作为测试,我从我们拥有的工作服务中删除了“startForeground(通知)”,它似乎仍在工作。
我们是否不需要在 Android O 及更高版本上发布工作服务的前台通知?
我无法找到这方面的具体文档。
任何引用都会很棒。
太感谢了
编辑
对于那些有同样问题的人,我已经在生产环境中测试了几天。我们的应用程序有一个持续的通知,我一直在从作业服务启动/更新它,而没有调用 startForeground,并且在 crashlytics 中没有看到任何安全异常。我有信心说:
对于短期运行的任务,您不需要从作业服务调用 startForeground (异常(exception)情况很可能适用于正在进行的任务。我的代码只是进行 api 调用并更新通知 View )
感谢 0X0nosugar 和 WasabiTea
最佳答案
To lower the chance of these problems, Android 8.0 places limitations on what apps can do while users aren't directly interacting with them. Apps are restricted in two ways:
Background Service Limitations: While an app is idle, there are limits to its use of background services. This does not apply to foreground services, which are more noticeable to the user.
Broadcast Limitations: With limited exceptions, apps cannot use their manifest to register for implicit broadcasts. They can still register for these broadcasts at runtime, and they can use the manifest to register for explicit broadcasts targeted specifically at their app.
In most cases, apps can work around these limitations by using JobScheduler jobs. This approach lets an app arrange to perform work when the app isn't actively running, but still gives the system the leeway to schedule these jobs in a way that doesn't affect the user experience. Android 8.0 offers several improvements to JobScheduler that make it easier to replace services and broadcast receivers with scheduled jobs; for more information, see JobScheduler improvements.
关于android - 奥利奥 : Does JobService not require startForeground?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53786042/
我是一名优秀的程序员,十分优秀!