Lost is a drop-in replacement for Google Play services Location APIs which offers open source alternatives to the FusedLocationProviderApi, GeofencingApi, and SettingsApi. It depends only on the Android SDK and makes calls directly to the LocationManager.
Over the last few months we’ve made significant updates to Lost, greatly expanding its functionality and bringing it closer to API parity with its closed-source counterpart. (For more background and history about the Lost project you can check out the original blog post when we first launched the library two years ago.)
Location services in the Mapzen Android SDK
Lost powers all location services in the Mapzen Android SDK and is responsible for things like showing your current location on the map, influencing search results, and tracking your progress as you navigate along a route.
Background location updates via PendingIntent
Lost now supports requesting background location updates. Developers can use the
FusedLocationProviderApi to request updates via
PendingIntent. We recommend having the
PendingIntent launch an
IntentService to handle work that needs to be done in response to location changes.
The new 2.0 release also includes basic support for geofencing, allowing developers to receive notifications when the device’s current location enters or exits a specified circular region. The
GeofencingApi is an important new feature of Lost and opens many new possibilities: developers of location-based apps can now show special content in particular regions, and games can change levels upon entrance of an area.
Users often change their location settings to conserve battery or increase privacy. When this occurs, an application’s location requirements may no longer be met. With an implementation of the
SettingsApi Lost now includes a mechanism to check the device’s current location and bluetooth settings, and optionally update them if they do not meet the requirements of a client application. All of these new features come with almost no overhead, making integration quite seamless.
Sometimes you don’t want to receive ongoing location updates but instead want to know, at discrete points in time, if a location is available. Using
LocationAvailability you can query to find out if any location providers are enabled, and if there is a last known location to report.
We want all of these new features to have as little impact on developers as possible, which is why we have removed permissions from the library manifest. All methods which require location or bluetooth permissions are now annotated, giving developers the freedom to choose which APIs and permissions they would like to include in their applications.
Documentation and sample app
If you are currently using Lost 1.X we put together a small migration guide to help you upgrade your app to use Lost 2.0. For more information check out the documentation and sample app. Let us know what you build with Lost and all the other new features in the Mapzen SDK!