I’m using the wakeful service pattern of the commonsware books.
My problem is to handle the service instance.
My goal is to check every X minutes for the current location of the user (doesn’t have to be very accurate), and do some logic with that.
The problem occures when I’m registering for location updates.
I put locationManager.removeUpdates(locationListener) on the “onDestroy” function but it still keep throwing me warnings from the messageQueue that his messsages are going to a dead thread.
I can’t let go from the location updates because if no other app is on the device, I’ll get old, not relevant, locations.
What can I do?
Thanks,
WakefulIntentServiceis not suitable for this, as the service will shut down onceonHandleIntent()returns. Instead, look at something likeLocationPoller, which uses a regularServicealong with aWakeLock, keeping the service running just long enough to get a location fix before shutting down the service.