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

Commit

Permalink
Add upgrade instructions for 1.x to 2.0 (#113)
Browse files Browse the repository at this point in the history
* Add upgrade instructions for 1.x to 2.0

* Add permission requirements
  • Loading branch information
sarahsnow1 authored and ecgreb committed Sep 30, 2016
1 parent d47b09e commit 626792e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This project seeks to provide an open source alternative to the [Google APIs][2]

Set up:
- [Installation](https://github.com/mapzen/lost/blob/master/docs/installation.md)
- [Upgrading 1.x to 2.0](https://github.com/mapzen/lost/blob/master/docs/upgrade-1x-2.md)
- [Getting Started](https://github.com/mapzen/lost/blob/master/docs/getting-started.md)
- [Getting the Last Known Location](https://github.com/mapzen/lost/blob/master/docs/last-known-location.md)
- [Receiving Location Updates](https://github.com/mapzen/lost/blob/master/docs/location-updates.md)
Expand Down
42 changes: 42 additions & 0 deletions docs/upgrade-1x-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#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:
```java
LostApiClient client = new LostApiClient.Builder(context).addConnectionCallbacks(callbacks).build();
client.connect(); //Client is ready for use
```

2.0:
```java
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 permissions from Lost's manifest, allowing developers to declare only the permissions they need in their client applications. In addition, developers also need to request and check for runtime permissions.

The permissions that Lost requires are as follows:

###FusedLocationProviderApi & GeofencingApi
```xml
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
```

###SettingsApi
```xml
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
```

0 comments on commit 626792e

Please sign in to comment.