问题
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