Is it possible starting Android Service and Broadcast when app did not run before

泪湿孤枕 提交于 2019-12-13 04:13:10

问题


If my app runs once, service can start and request to server on background. But when app did not run before, service could not start. Is it possible starting service even that app have not runned before.

Actually what I want to do is that phone can send request to server for once without even runned before. When request sended, it will be activation. Later request is not to require.


回答1:


No, it isn't possible.

When your app is getting installed for the first time OR was force-closed by the user, it is in "inactive" state (meaning no broadcast receivers or alarms will work), and will become active only when the user launches it manually.

See details here



来源:https://stackoverflow.com/questions/32111094/is-it-possible-starting-android-service-and-broadcast-when-app-did-not-run-befor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!