Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I do location tracking on iPhone more efficiently than leaving GPS on all the time?

I am working on a location app for the iPhone (iOS 6), that constantly sends accurate location information to a web service. I have it set-up so that the app sends a location packet every minute (as long as there has been a significant change in position). This part of the app is working great (as a background task), but as you might expect it affects battery life significantly having GPS on all the time (I get about 6 hours which isn't too bad given I'm used to plugging in my phone in the car and when at home so I can get through the day OK, but I need to stretch this out to at least 16 hours to be practical).

What I would like to do is turn the GPS off when the phone indicates that it hasn't moved significantly for a while. This is trivial to do using the GPS data itself. However, with the GPS off, what might I use as a trigger to turn it back on again, and restart location posting? I could just turn it off when it is sensed that no new position has been generated for say 5 minutes, and then check the position X minutes later to see if it has changed, and act accordingly. Or maybe I could use the accelerometer in some clever way, or some other sensor, to trigger turning on GPS again.

Given that travel time is often a small part of the day, it makes sense to minimize GPS activity when at home, or in the office... but how to do that reliably?

like image 759
ProfNimrod Avatar asked Oct 21 '22 22:10

ProfNimrod


2 Answers

The model I might contemplate is to use the standard location service to get my location, and once I've got that, turn it off and turn on the significant change location service which uses far less power. And, once I got a subsequent significant change notification (you might want to disregard the first one as you already had the accurate location), you can turn the standard location service again to get the accurate location (assuming you need that at all ... if you didn't need super accurate location, you'd obviously just use significant change location service from the get-go).

Alternatively, if you're doing that and it's still using too much power, you could turn off location services entirely and then turn it back on after a certain amount of time, but you might lose significant location changes in the interim and if the user isn't moving at all, it will use more power than the above technique in many scenarios.

like image 60
Rob Avatar answered Oct 31 '22 18:10

Rob


This isn't a complete answer, but an alternative to using GPS altogether is inertial dead (deduced) reckoning. This can be achieved using only the accelerometer and gyros (and a bit of clever maths), with GPS once in a while as a check. I don't know how accurate this approach would be, or what it's impact on battery time would be... I'll let you know when I've implemented it ;-)

Although Android accelerometer accuracy (Inertial navigation) seems to suggest it isn't worth the effort, but I think that is using an accelerometer only, and doesn't make use of gyros - the two devices provide different aspects of motion: Gyroscope vs Accelerometer?.

like image 34
ProfNimrod Avatar answered Oct 31 '22 19:10

ProfNimrod