0

I am building an android app with a map inside of it. It seems that when the user leaves the app (home button or back button), the app still uses cpu. The User and Kernal field jump from 0.00% to about 0.86% (at max) all the time after the user leaves the app. It seems to be killing the battery in my phone if I don't force close the app. Could the GPS be the issue of always searching? How could I stop all running processes with GPS if that is the issue?

thanks!

mitch94
  • 236
  • 1
  • 3
  • 11

1 Answers1

0

To kill a process you can use

android.os.Process.killProcess(android.os.Process.<PID>());
Naman Jain
  • 63
  • 1
  • 9
  • This won't quite work since I am using fragments. When a user clicks on a link to go to a new activity, I can't use that code in case the user wants to go back to the original fragment activity. Not sure how I could detect whether a user is going to another activity or leaving the app. – mitch94 Oct 24 '15 at 15:01