szpic
szpic

Reputation: 4498

Running in Background

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).

Upvotes: 0

Views: 51

Answers (1)

RvdK
RvdK

Reputation: 19800

Yes, this is the only way. Use a normal Service, you can also make it sticky to let is restart itself when Android kills it because of low resources.

Use startService to start is. If you are using bindService it will stop the Service when the Activity is killed. You probably don't want that. Don't forget to call stopService when you don't want to use the Service anymore.

IntentService is not suitable because it will stop itself when done.

Upvotes: 1

Related Questions