背景
我想使用Lollipop上提供的新JobScheduler API,但遗憾的是它没有Lollipop之前的官方端口。
但是,有GcmTaskService,它提供了非常相似的功能。
问题
这个API是相当新的,因此很少有地方可以查找有关如何使用它的信息(例如here和here)。
问题
我对此新API有一些疑问:
编辑:那是因为我错过了RECEIVE_BOOT_COMPLETED的许可。
The scheduler will hold a PowerManager.WakeLock for your service, however after three minutes of execution if your task has not returned it will be considered to have timed out, and the wakelock will be released. Rescheduling your task at this point will have no effect. If you suspect your task will run longer than this you should start your own service explicitly or use some other mechanism; this API is intended for relatively quick network operations.
最佳答案
您可以在此处找到大多数问题的答案。
https://github.com/jacktech24/gcmnetworkmanager-android-example/blob/master/README.md
到那里没有答案的答案
7:移除唤醒锁后,您不会收到通知,正如他们在文档中所说的那样,此API仅用于短期任务,如果您有更长的时间,请编写自己的实现
9:不,您目前还不能,API不允许
10:那是因为Google Play服务正在处理它,而且没有办法解决。您必须在服务中检测是否已安装该应用程序(我想这是您的问题),例如。创建配置等,并在其中一项被调用时最终取消所有任务。
关于android - 有关GcmTaskService的一些问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31426052/