Skip to content
This repository has been archived by the owner on Apr 23, 2023. It is now read-only.

Latest commit

 

History

History
44 lines (34 loc) · 1.62 KB

upgrade-1x-2.md

File metadata and controls

44 lines (34 loc) · 1.62 KB

Upgrading from Lost 1.x

Add Connection Callbacks

Lost 2.0 introduces an underlying Service in the FusedLocationProviderApi. Because of this, connecting a LostApiClient requires that developers add ConnectionCallbacks so that they know when the client has connected and is ready to use.

1.x:

LostApiClient client = new LostApiClient.Builder(context).addConnectionCallbacks(callbacks).build();
client.connect(); // Client is ready for use

2.0:

LostApiClient.ConnectionCallbacks callbacks = new LostApiClient.ConnectionCallbacks() {
    @Override public void onConnected() {
        // Client is ready for use
    }

    @Override public void onConnectionSuspended() {

    }
};
LostApiClient client = new LostApiClient.Builder(context).addConnectionCallbacks(callbacks).build();
client.connect(); // Client is NOT ready for use

Explicitly Request Permissions

We have removed all permissions from Lost's AndroidManifest.xml, allowing developers to declare only the permissions they need in their client applications.

In addition, developers targeting Android M (API 23) and above also need to request runtime permissions.

The permissions that Lost requires are as follows:

FusedLocationProviderApi & GeofencingApi

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

SettingsApi

<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>