I think you pretty much got it. I have a very similar solution where I want to "enter and exit" as soon as I can.
I implemented a "precision" check in my algorithm. I provide the service within 1 minute from the start to get the BEST possible location, or I will exit even earlier if I get a fix of 25 m or better.
In addition, I do not use AsyncTask for the location itself. The service does not block the stream, it receives and processes callbacks from the LocationManager, so I donβt see why you want to make AsyncTask.
When I finished getting the location and going to exit - I call an asynchronous task to process the Http message to the server.
As for the interval - I give custom options 5/15/30 / 1hr and 1 / 2day. I use inaccurate alarms for this - supposedly better on battery.
source share