Hello, I'm building a boating app that tracks where you dropped anchor and monitors your position to see if you're drifting. I wanted the app to stay running until explicitly stopped so I decided to implement a service to handle the GPS location checking and notifications.
The problem I'm running into is with when to stop the service. Since part of the service's job is to alert (presumably someone sleeping) that the anchor is dragging I want the notification portion to remain running until explicitly stopped. For this reason I'm using startService() when the app initially runs. this worked except that when I exited the app (using the back button) the service wouldn't die even though I had a stopService call in onDestroy(). My work around was to use startService with an extra (call it an action signal) that would signal the service to shut itself down. That worked great as long as my app is locked in a given orientation but now I'm wanting to make it orientation aware. The issue now is when I switch orientations the UI activity executes the onDestroy method which kills the service and starts it up again when onCreate is executed. I'm saving state and rebuilding everything so the app runs as expected. Is there a better method to accomplish this that doesn't include killing and starting the service? I'm fairly new to Android and Java so I'm not sure what the best way is to do some things so any guidance would be greatly appreciated. Thanks, Chris -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en