user1065490
user1065490

Reputation: 305

Android process should not pause when screen is locked

I have one process running in android device the problem is process is going to pause state when i lock the screen and resumes from the same point when I unlock the screen, I want that process to run continuously even if device screen is locked(i.e when screen is off)... Please suggest me the best possible solution..

Thanks in advance..

Upvotes: 0

Views: 4079

Answers (2)

Konstantin Pribluda
Konstantin Pribluda

Reputation: 12367

Your solution is caleld service ( some piece of code running independet of UI ) . When screen is locked, whatever activity is in focus receives onPause() callback and is stopped.

You will have consider battery consumption issue. Just answer yourself questions

  • does your service really have to run permanently in background?
  • can work be done with irregular callbacks?

Consider to implement it as broadcast receiver weacked up by periodic alarms

Upvotes: 0

Related Questions