How to use Ti.Geolocation safely for battery?

You must Login before you can answer or comment on any questions.

I develop an application that send coordinates to server every 10 minutes. When i start my app battery level drop for 10% per hour. I don't need in best accuracy but i need to send coordinates every 10-15 minutes more safely for battery. That's how i do it in my iOS background service:

if (Ti.App.Properties.getBool("gpsInBackground", true)) {
            Ti.Geolocation.setAccuracy(Ti.Geolocation.ACCURACY_HIGH);
        }
        else {
            Ti.Geolocation.setAccuracy(Ti.Geolocation.ACCURACY_LOW);
        }
 
        try {
            Ti.Geolocation.getCurrentPosition(function(e) {
                sendCoordinateToServer(e);
            });
        }
        catch(e) {
            Ti.API.log(e);
        }
But there is no difference between Ti.Geolocation.ACCURACY_HIGH and Ti.Geolocation.ACCURACY_LOW for battery. Independent from this parameter, my battery's level going down for 8-10% per hour.

Is there a way to complete my task more safely for battery?

1 Answer

Accepted Answer

Did you have any luck with decreasing the strain on the battery? I'm having the exact same issue.

— answered 12 months ago by Chris Bill
answer permalink
4 Comments
  • Unfortunaty i haven't any success result. I still trying to fix this problem. Please write me if you found some fix.

    — commented 12 months ago by Alexander Perechnev

  • The best thing I could do to lower the battery drain was to close all of the windows when the app gets paused. Then when the app is resumed to reopen the needed windows. Doing this seems to puts less of a strain on the phone. Which makes sense because it doesn't have to keep track anything else when paused but the timer for the gps. Hope this helps!!

    — commented 12 months ago by Chris Bill

  • Thank you for answering. All my windows is in TabGroup. Can i close only this TabGroup when my application go to background service?

    — commented 12 months ago by Alexander Perechnev

  • Show 1 more comment

Your Answer

Think you can help? Login to answer this question!