Git Product home page Git Product logo

glassmaprelaytechnology's Introduction

GlassMapRelayTechnology

Glassmap (recently acquired by Groupon) implemented what they call "Relay Technology" in order to reduce battery drain while running in the background on iOS. When the company launched they claimed to reduce battery drain from background location updates by an order of magnitude from 5%/hour to .5%/hour (source). When I found out about Glassmap I did a bit of research, found the solution, and wrote a blog post about my findings. The blog post continues to get interest and hits (mostly through Quora), and the real missing piece was the proof of concept. This project is meant to serve as a proof of concept for how the Glassmap Relay Technology works on iOS.

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

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.

glassmaprelaytechnology's People

Contributors

donohue avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

setuc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.