Quick Answer: How Can I Make My Android Service Unstoppable and Run It Continuously?
Contents How Can I Make a Service Run Continuously on Android? 9 Answers in the Service onStartCommand Method Return Start_Sticky. … Start the Service in the...
Contents
How can I make a service run continuously on Android?
9 Answers
- In the service onStartCommand method return START_STICKY. …
- Start the service in the background using startService(MyService) so that it always stays active regardless of the number of bound clients. …
- Create the binder. …
- Define a service connection. …
- Bind to the service using bindService.
2 апр. 2013 г.
How do I keep my service alive android?
Keeping your app alive
- Start your Service with Context. startService()
- Call Service. startForeground() as soon as possible in onStartCommand().
- Return START_STICKY from onStartCommand() to make sure you get restarted by the system in case your app still gets killed at a low-memory situation.