Downgrade min sdk to 14 (#10355)
* [android] - downgrade minimum sdk version to 14 * [android] bump MAS version to the one which includes min sdk version 14 * bump lost version to 3.0.4
This commit is contained in:
@@ -6,7 +6,6 @@ dependencies {
|
||||
compile rootProject.ext.dep.timber
|
||||
compile rootProject.ext.dep.okhttp3
|
||||
provided(rootProject.ext.dep.lost) {
|
||||
exclude group: 'com.google.guava'
|
||||
exclude group: 'com.android.support'
|
||||
}
|
||||
testCompile rootProject.ext.dep.junit
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mapbox.mapboxsdk">
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.mapbox.mapboxsdk">
|
||||
|
||||
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
|
||||
<uses-feature android:name="android.hardware.wifi" android:required="false" /> <!-- Implied by ACCESS_WIFI_STATE. -->
|
||||
<uses-feature android:name="android.hardware.location.gps" android:required="false"/>
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||
|
||||
<uses-sdk tools:overrideLibrary="com.mapzen.lost"/>
|
||||
|
||||
<application>
|
||||
<!-- Include the telemetry service to simplify set up (https://www.mapbox.com/telemetry) -->
|
||||
<service android:name="com.mapbox.services.android.telemetry.service.TelemetryService"/>
|
||||
|
||||
@@ -32,7 +32,7 @@ import com.mapzen.android.lost.api.LostApiClient;
|
||||
* @deprecated Use a {@link Mapbox#getLocationEngine()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public class LocationSource extends LocationEngine implements LocationListener {
|
||||
public class LocationSource extends LocationEngine implements LostApiClient.ConnectionCallbacks, LocationListener {
|
||||
|
||||
private Context context;
|
||||
private LostApiClient lostApiClient;
|
||||
@@ -45,7 +45,9 @@ public class LocationSource extends LocationEngine implements LocationListener {
|
||||
public LocationSource(Context context) {
|
||||
super();
|
||||
this.context = context.getApplicationContext();
|
||||
lostApiClient = new LostApiClient.Builder(this.context).build();
|
||||
lostApiClient = new LostApiClient.Builder(this.context)
|
||||
.addConnectionCallbacks(this)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,12 +63,7 @@ public class LocationSource extends LocationEngine implements LocationListener {
|
||||
*/
|
||||
@Override
|
||||
public void activate() {
|
||||
if (!lostApiClient.isConnected()) {
|
||||
lostApiClient.connect();
|
||||
}
|
||||
for (LocationEngineListener listener : locationListeners) {
|
||||
listener.onConnected();
|
||||
}
|
||||
connect();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,7 +73,7 @@ public class LocationSource extends LocationEngine implements LocationListener {
|
||||
*/
|
||||
@Override
|
||||
public void deactivate() {
|
||||
if (lostApiClient.isConnected()) {
|
||||
if (lostApiClient != null && lostApiClient.isConnected()) {
|
||||
lostApiClient.disconnect();
|
||||
}
|
||||
}
|
||||
@@ -92,6 +89,24 @@ public class LocationSource extends LocationEngine implements LocationListener {
|
||||
return lostApiClient.isConnected();
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked when the location provider has connected.
|
||||
*/
|
||||
@Override
|
||||
public void onConnected() {
|
||||
for (LocationEngineListener listener : locationListeners) {
|
||||
listener.onConnected();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked when the location provider connection has been suspended.
|
||||
*/
|
||||
@Override
|
||||
public void onConnectionSuspended() {
|
||||
// Empty
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Last known location is the location provider is connected and location permissions are granted.
|
||||
*
|
||||
@@ -102,7 +117,7 @@ public class LocationSource extends LocationEngine implements LocationListener {
|
||||
public Location getLastLocation() {
|
||||
if (lostApiClient.isConnected()) {
|
||||
//noinspection MissingPermission
|
||||
return LocationServices.FusedLocationApi.getLastLocation();
|
||||
return LocationServices.FusedLocationApi.getLastLocation(lostApiClient);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -136,7 +151,7 @@ public class LocationSource extends LocationEngine implements LocationListener {
|
||||
|
||||
if (lostApiClient.isConnected()) {
|
||||
//noinspection MissingPermission
|
||||
LocationServices.FusedLocationApi.requestLocationUpdates(request, this);
|
||||
LocationServices.FusedLocationApi.requestLocationUpdates(lostApiClient, request, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +161,7 @@ public class LocationSource extends LocationEngine implements LocationListener {
|
||||
@Override
|
||||
public void removeLocationUpdates() {
|
||||
if (lostApiClient.isConnected()) {
|
||||
LocationServices.FusedLocationApi.removeLocationUpdates(this);
|
||||
LocationServices.FusedLocationApi.removeLocationUpdates(lostApiClient, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,4 +186,14 @@ public class LocationSource extends LocationEngine implements LocationListener {
|
||||
listener.onLocationChanged(location);
|
||||
}
|
||||
}
|
||||
|
||||
private void connect() {
|
||||
if (lostApiClient != null) {
|
||||
if (lostApiClient.isConnected()) {
|
||||
onConnected();
|
||||
} else {
|
||||
lostApiClient.connect();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
ext {
|
||||
minSdkVersion = 15
|
||||
minSdkVersion = 14
|
||||
targetSdkVersion = 25
|
||||
compileSdkVersion = 25
|
||||
buildToolsVersion = "25.0.2"
|
||||
@@ -7,7 +7,7 @@ ext {
|
||||
versionCode = 11
|
||||
versionName = "5.0.0"
|
||||
|
||||
mapboxServicesVersion = "2.2.8"
|
||||
mapboxServicesVersion = "2.2.9"
|
||||
supportLibVersion = "25.4.0"
|
||||
espressoVersion = '3.0.1'
|
||||
testRunnerVersion = '1.0.1'
|
||||
@@ -20,7 +20,7 @@ ext {
|
||||
mapboxAndroidTelemetry : "com.mapbox.mapboxsdk:mapbox-android-telemetry:${mapboxServicesVersion}@aar",
|
||||
|
||||
// mapzen lost
|
||||
lost : 'com.mapzen.android:lost:1.1.1',
|
||||
lost : 'com.mapzen.android:lost:3.0.4',
|
||||
|
||||
// unit test
|
||||
junit : 'junit:junit:4.12',
|
||||
|
||||
Reference in New Issue
Block a user