summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDKTestApp
diff options
context:
space:
mode:
authorTobrun <tobrun@mapbox.com>2017-06-30 11:21:39 +0200
committerGitHub <noreply@github.com>2017-06-30 11:21:39 +0200
commit95735c06f6c394bde67532913fd7b51b2938cbc1 (patch)
treebc95cb7400706ee78541354b3d5fd26449154e53 /platform/android/MapboxGLAndroidSDKTestApp
parent3821ce27de9da37fd8ea04e292ca9fdfea2d8ab7 (diff)
downloadqtlocation-mapboxgl-95735c06f6c394bde67532913fd7b51b2938cbc1.tar.gz
Downgrade location provider dependency (#9394)
* [android] - downgrade LOST to Mapbox SDK 5.0.2 version. * bump LOST back to Mapbox Android SDK version 4.x
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp')
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java27
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java22
2 files changed, 14 insertions, 35 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java
index 8657434127..69e6d64325 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java
@@ -16,7 +16,6 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.maps.MapboxMapOptions;
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
import com.mapbox.mapboxsdk.testapp.R;
-
import com.mapzen.android.lost.api.LocationListener;
import com.mapzen.android.lost.api.LocationRequest;
import com.mapzen.android.lost.api.LocationServices;
@@ -25,8 +24,7 @@ import com.mapzen.android.lost.api.LostApiClient;
/**
* Test activity showcasing how to change the MyLocationView drawable.
*/
-public class MyLocationDrawableActivity extends BaseLocationActivity implements LostApiClient.ConnectionCallbacks,
- LocationListener {
+public class MyLocationDrawableActivity extends BaseLocationActivity implements LocationListener {
private MapView mapView;
private MapboxMap mapboxMap;
@@ -69,30 +67,22 @@ public class MyLocationDrawableActivity extends BaseLocationActivity implements
protected void enableLocation(boolean enabled) {
mapboxMap.setMyLocationEnabled(enabled);
if (lostApiClient == null) {
- lostApiClient = new LostApiClient.Builder(this).addConnectionCallbacks(this).build();
+ lostApiClient = new LostApiClient.Builder(this).build();
lostApiClient.connect();
+ LocationRequest request = LocationRequest.create()
+ .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
+ .setInterval(5000)
+ .setSmallestDisplacement(10);
+ LocationServices.FusedLocationApi.requestLocationUpdates(request, this);
}
}
@Override
- public void onConnected() {
- LocationRequest request = LocationRequest.create()
- .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
- .setInterval(5000)
- .setSmallestDisplacement(10);
- LocationServices.FusedLocationApi.requestLocationUpdates(lostApiClient, request, this);
- }
-
- @Override
public void onLocationChanged(Location location) {
mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location), 14));
}
@Override
- public void onConnectionSuspended() {
- }
-
- @Override
protected void onStart() {
super.onStart();
mapView.onStart();
@@ -115,10 +105,9 @@ public class MyLocationDrawableActivity extends BaseLocationActivity implements
super.onStop();
mapView.onStop();
if (lostApiClient.isConnected()) {
- LocationServices.FusedLocationApi.removeLocationUpdates(lostApiClient, this);
+ LocationServices.FusedLocationApi.removeLocationUpdates(this);
lostApiClient.disconnect();
}
- lostApiClient.unregisterConnectionCallbacks(this);
}
@Override
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java
index c4d29bebec..786aeb8733 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java
@@ -38,8 +38,8 @@ import timber.log.Timber;
* using gesture configurations.
* </p>
*/
-public class MyLocationTrackingModeActivity extends AppCompatActivity implements
- AdapterView.OnItemSelectedListener, OnMapReadyCallback, LostApiClient.ConnectionCallbacks, LocationListener {
+public class MyLocationTrackingModeActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener,
+ OnMapReadyCallback, LocationListener {
// Testing for user defined LostApiClient
private LostApiClient lostApiClient;
@@ -75,27 +75,18 @@ public class MyLocationTrackingModeActivity extends AppCompatActivity implements
@Override
public void onMapReady(MapboxMap mapboxMap) {
MyLocationTrackingModeActivity.this.mapboxMap = mapboxMap;
- lostApiClient = new LostApiClient.Builder(this).addConnectionCallbacks(this).build();
+ lostApiClient = new LostApiClient.Builder(this).build();
lostApiClient.connect();
- }
-
- @Override
- public void onConnected() {
LocationRequest request = LocationRequest.create()
.setPriority(LocationRequest.PRIORITY_LOW_POWER)
.setInterval(5000)
.setSmallestDisplacement(10);
- Location location = LocationServices.FusedLocationApi.getLastLocation(lostApiClient);
+ Location location = LocationServices.FusedLocationApi.getLastLocation();
if (location != null) {
setInitialLocation(location, 15);
}
- LocationServices.FusedLocationApi.requestLocationUpdates(lostApiClient, request, this);
- }
-
- @Override
- public void onConnectionSuspended() {
-
+ LocationServices.FusedLocationApi.requestLocationUpdates(request, this);
}
@Override
@@ -237,8 +228,7 @@ public class MyLocationTrackingModeActivity extends AppCompatActivity implements
protected void onStop() {
super.onStop();
if (lostApiClient.isConnected()) {
- LocationServices.FusedLocationApi.removeLocationUpdates(lostApiClient, this);
- lostApiClient.unregisterConnectionCallbacks(this);
+ LocationServices.FusedLocationApi.removeLocationUpdates(this);
lostApiClient.disconnect();
}
mapView.onStop();