Glassmap Relay Technology Proof Of Concept

2 min read Original article ↗

About a year ago I wrote a blog post about how Glassmap’s Relay Technology is able to reduce battery drain from background location updates on iOS from 5%/hour to .5%/hour. I had always planned on implementing a proof-of-concept, but I put it off for a long time because I was busy building echo. One night before bed I wrote a quick iOS application to demonstrate the proof-of-concept and it’s available on GitHub now!

Proof Of Concept

The proof of concept is extremely simple, but it requires that the application implement both background location updates and VOIP capabilities for iOS. The UIApplication setKeepAliveTimeout:handler: function available with VOIP allows the application to have another background hook which can then allow a developer to turn background location updates on and off as necessary.

The proof of concept is comprised of roughly 40 lines of code, and simply turns the background location updates on/off every 10 minutes:

  • Register for location updates in background
  • Register for VOIP keep alive handler
  • Switch background location updates on/off every 10 minutes (smallest allowed keep alive timeout)

Sample Output

(Note the 10 minute intervals between registering the handler, turning location updates off, and turning location updates back on)

2013-05-13 23:14:30.280 GlassmapRelayTechnology[51779:c07] Keep alive handler registered

2013-05-13 23:14:30.287 GlassmapRelayTechnology[51779:c07] Did update to location: 40.747214, -74.004722

2013-05-13 23:14:30.943 GlassmapRelayTechnology[51779:c07] Did update to location: 40.747214, -74.004722

…….

2013-05-13 23:24:30.025 GlassmapRelayTechnology[51779:c07] Did update to location: 40.747214, -74.004722

2013-05-13 23:24:30.274 GlassmapRelayTechnology[51779:c07] Keep alive: Stopping location updates

2013-05-13 23:34:30.269 GlassmapRelayTechnology[51779:c07] Keep alive: Starting location updates

2013-05-13 23:34:30.275 GlassmapRelayTechnology[51779:c07] Did update to location: 40.747214, -74.004722

Implications

Developer control of background location updates can significantly improve battery life for iOS applications by turning the updates off when the developer sees fit. For instance, if a user has been stationary for a few hours it is probably safe to assume they are at work or home and the background location updates can be turned off to save battery life. None of that logic is implemented in this proof of concept, but essentially that is how Glassmap was able to achieve the battery savings while the application was running in the background.