Location APIs in Google I/O – the foundation for more
In the recently concluded Google I/O conference, Google announced three location based service APIs – the fused location API, geofencing API and the activity API – that could make apps a lot more context sensitive.
Application interfaces are relatively static, but with these APIs, the application interface could adapt to the user’s location and context.
Here’s a quick look at the APIs:
Fused location provider API
GPS feasts on your smartphone’s battery (though not as much as the display does). Many users turn GPS off on their phones to extend battery life, and even apps use it cautiously.
However, GPS (or location) is also a key component of what many of the interesting apps and services rely on (pic of Google Now).
To handle the battery life problem, Google announced a fused location API. In principle, this would be a single API that would let users access location services. Behind the scenes, the API combines GPS, WiFi, cellular data and other sensors to detect the user’s location.
The Next Web writes:
Developers will have access to three levels of location-information priority. Keep in mind that the more accurate your location data, the more power you are using.
- High Accuracy: 5 second check interval, consumes 7.25% per hour, accurate to within around 20 meters, uses GPS when outside, and WiFi when inside.
- Balanced Power: 20 second check interval, 0.6% battery usage per hour, and accurate to within 40 meters. This method is what it appears that Google envisions as a way to bring location into a host of new applications, without sacrificing end-user device satisfaction.
- No Power: No poll interval, no power consumption, accurate to within around one mile.
Geofences are areas that an app or user can choose on a map to trigger an alert, eg: a location based reminder. As a user, you would mark a spot and a radius to alert you that you’re near the location. As you move, the Android keeps checking whether your current location falls within the radius. If so, it pulls up the relevant application or alert.
Geofences can also trigger events on exit, though that is more common for fleet tracking applications.
Since geofences involve constant checks whether the current location falls within the desired radius, it drains the battery. Google has reduced power requirements by close to two-thirds. Apps can create up to 100 geofences for their own use.
Activity recognition API
This is probably the most exciting API of the three. Using the other sensors like the accelerometer, Google tries predicting the user’s activity – biking, walking, standing still, etc using machine learning. It also tries not turning on GPS to ensure low power requirements for the mode.
These APIs could be the foundation for more interesting stuff ahead.
For instance, we may see an app that lets you search for all veg restaurants within 5 km, then automatically set a geofence around each. As you drive past, the app could notify you of restaurants immediately ahead.
Or maybe you could have an app that automatically detects your home and office depending on when you’re there, and turn off WiFi when you’re away from either to save battery life.
Think of all the info that your app has access to: It can sense the time of the day, orientation in three-dimensional space, motion, location, and much more.
In addition, there are multiple other information sources that the app can tap into using relevant APIs. eg: weather, sunrise/sunset, etc.
The new location APIs from Google mean that apps now can use GPS more confidently without worrying about battery drain, and mesh the others to come up with interesting services.