Hi I have simple question
I need to run my app in the background when the screen is locked.
Using service is the only way? Its seems complicated for my simple program.
( i’m writing simple gps logger which must be logging even if user blocked the phone).
Hi I have simple question I need to run my app in the background
Share
Yes, this is the only way. Use a normal
Service, you can also make itstickyto let is restart itself whenAndroidkills it because of low resources.Use
startServiceto start is. If you are usingbindServiceit will stop theServicewhen theActivityis killed. You probably don’t want that.Don’t forget to call
stopServicewhen you don’t want to use the Service anymore.IntentServiceis not suitable because it will stop itself when done.