[android] Remove com.google.android.gms.location (#379) (#801)

This commit is contained in:
Bart Louwers
2023-02-15 11:22:44 +01:00
committed by GitHub
parent 4a34caab75
commit 982ac6e7e3
19 changed files with 83 additions and 771 deletions

View File

@@ -40,7 +40,8 @@ class LatLng : Parcelable {
@Keep
var latitude = 0.0
set(
@FloatRange(from = GeometryConstants.MIN_LATITUDE, to = GeometryConstants.MAX_LATITUDE) latitude) {
@FloatRange(from = GeometryConstants.MIN_LATITUDE, to = GeometryConstants.MAX_LATITUDE) latitude
) {
require(!latitude.isNaN()) { "latitude must not be NaN" }
require(abs(latitude) <= GeometryConstants.MAX_LATITUDE) { "latitude must be between -90 and 90" }
field = latitude

View File

@@ -20,7 +20,7 @@ import com.mapbox.mapboxsdk.camera.CameraUpdate;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.location.engine.LocationEngine;
import com.mapbox.mapboxsdk.location.engine.LocationEngineCallback;
import com.mapbox.mapboxsdk.location.engine.LocationEngineProvider;
import com.mapbox.mapboxsdk.location.engine.LocationEngineDefault;
import com.mapbox.mapboxsdk.location.engine.LocationEngineRequest;
import com.mapbox.mapboxsdk.location.engine.LocationEngineResult;
import com.mapbox.mapboxsdk.location.modes.CameraMode;
@@ -66,7 +66,7 @@ import static com.mapbox.mapboxsdk.location.modes.RenderMode.GPS;
* <p>
* <strong>
* To get the component object use {@link MapboxMap#getLocationComponent()} and activate it with
* {@link #activateLocationComponent(Context, Style)} or one of the overloads.
* {@link #activateLocationComponent(LocationComponentActivationOptions)}.
* Then, manage its visibility with {@link #setLocationComponentEnabled(boolean)}.
* The component will not process location updates right after activation, but only after being enabled.
* </strong>
@@ -76,19 +76,17 @@ import static com.mapbox.mapboxsdk.location.modes.RenderMode.GPS;
* {@code ACCESS_COARSE_LOCATION} or {@code ACCESS_FINE_LOCATION} permissions can be requested for
* this component to work as expected.
* <p>
* This component offers a default, built-in {@link LocationEngine} with some of the activation methods.
* This engine will be obtained by {@link LocationEngineProvider#getBestLocationEngine(Context, boolean)} which defaults
* to the {@link com.mapbox.mapboxsdk.location.engine.MapboxFusedLocationEngineImpl}. If you'd like to utilize Google
* Play Services
* for more precise location updates, simply add the Google Play Location Services dependency in your build script.
* This will make the default engine the {@link com.mapbox.mapboxsdk.location.engine.GoogleLocationEngineImpl} instead.
* This component offers a default, built-in {@link LocationEngine} called
* {@link com.mapbox.mapboxsdk.location.engine.MapboxFusedLocationEngineImpl}.
* If you'd like to utilize the previously available Google Play Services for more precise location updates,
* refer to the migration guide of 10.0.0 in the changelog.
* After a custom engine is passed to the component, or the built-in is initialized,
* the location updates are going to be requested with the {@link LocationEngineRequest}, either a default one,
* or the one passed during the activation.
* When using any engine, requesting/removing the location updates is going to be managed internally.
* <p>
* You can also push location updates to the component without any internal engine management.
* To achieve that, use {@link #activateLocationComponent(Context, Style, boolean)} with false.
* To achieve that, set `useDefaultLocationEngine` in {@link LocationComponentActivationOptions} to false.
* No engine is going to be initialized and you can push location updates with {@link #forceLocationUpdate(Location)}.
* <p>
* For location puck animation purposes, like navigation,
@@ -105,8 +103,6 @@ public final class LocationComponent {
private final Transform transform;
private Style style;
private LocationComponentOptions options;
@NonNull
private InternalLocationEngineProvider internalLocationEngineProvider = new InternalLocationEngineProvider();
@Nullable
private LocationEngine locationEngine;
@NonNull
@@ -218,7 +214,6 @@ public final class LocationComponent {
@NonNull LocationAnimatorCoordinator locationAnimatorCoordinator,
@NonNull StaleStateManager staleStateManager,
@NonNull CompassEngine compassEngine,
@NonNull InternalLocationEngineProvider internalLocationEngineProvider,
boolean useSpecializedLocationLayer) {
this.mapboxMap = mapboxMap;
this.transform = transform;
@@ -230,242 +225,10 @@ public final class LocationComponent {
this.locationAnimatorCoordinator = locationAnimatorCoordinator;
this.staleStateManager = staleStateManager;
this.compassEngine = compassEngine;
this.internalLocationEngineProvider = internalLocationEngineProvider;
this.useSpecializedLocationLayer = useSpecializedLocationLayer;
isComponentInitialized = true;
}
/**
* This method initializes the component and needs to be called before any other operations are performed.
* Afterwards, you can manage component's visibility by {@link #setLocationComponentEnabled(boolean)}.
* <p>
* <strong>Note</strong>: This method will initialize and use an internal {@link LocationEngine} when enabled.
*
* @param context the context
* @param style the proxy object for current map style. More info at {@link Style}
* @deprecated use {@link LocationComponentActivationOptions.Builder} instead
*/
@Deprecated
public void activateLocationComponent(@NonNull Context context, @NonNull Style style) {
activateLocationComponent(context, style,
LocationComponentOptions.createFromAttributes(context, R.style.maplibre_LocationComponent));
}
/**
* This method initializes the component and needs to be called before any other operations are performed.
* Afterwards, you can manage component's visibility by {@link #setLocationComponentEnabled(boolean)}.
*
* @param context the context
* @param style the proxy object for current map style. More info at {@link Style}
* @param useDefaultLocationEngine true if you want to initialize and use the built-in location engine or false if
* there should be no location engine initialized
* @deprecated use {@link LocationComponentActivationOptions.Builder} instead
*/
@Deprecated
public void activateLocationComponent(@NonNull Context context, @NonNull Style style,
boolean useDefaultLocationEngine) {
if (useDefaultLocationEngine) {
activateLocationComponent(context, style, R.style.maplibre_LocationComponent);
} else {
activateLocationComponent(context, style, null, R.style.maplibre_LocationComponent);
}
}
/**
* This method initializes the component and needs to be called before any other operations are performed.
* Afterwards, you can manage component's visibility by {@link #setLocationComponentEnabled(boolean)}.
*
* @param context the context
* @param style the proxy object for current map style. More info at {@link Style}
* @param useDefaultLocationEngine true if you want to initialize and use the built-in location engine or false if
* there should be no location engine initialized
* @param locationEngineRequest the location request
* @deprecated use {@link LocationComponentActivationOptions.Builder} instead
*/
@Deprecated
public void activateLocationComponent(@NonNull Context context, @NonNull Style style,
boolean useDefaultLocationEngine,
@NonNull LocationEngineRequest locationEngineRequest) {
setLocationEngineRequest(locationEngineRequest);
if (useDefaultLocationEngine) {
activateLocationComponent(context, style, R.style.maplibre_LocationComponent);
} else {
activateLocationComponent(context, style, null, R.style.maplibre_LocationComponent);
}
}
/**
* This method initializes the component and needs to be called before any other operations are performed.
* Afterwards, you can manage component's visibility by {@link #setLocationComponentEnabled(boolean)}.
*
* @param context the context
* @param style the proxy object for current map style. More info at {@link Style}
* @param useDefaultLocationEngine true if you want to initialize and use the built-in location engine or false if
* there should be no location engine initialized
* @param locationEngineRequest the location request
* @param options the options
* @deprecated use {@link LocationComponentActivationOptions.Builder} instead
*/
@Deprecated
public void activateLocationComponent(@NonNull Context context, @NonNull Style style,
boolean useDefaultLocationEngine,
@NonNull LocationEngineRequest locationEngineRequest,
@NonNull LocationComponentOptions options) {
setLocationEngineRequest(locationEngineRequest);
if (useDefaultLocationEngine) {
activateLocationComponent(context, style, options);
} else {
activateLocationComponent(context, style, null, options);
}
}
/**
* This method initializes the component and needs to be called before any other operations are performed.
* Afterwards, you can manage component's visibility by {@link #setLocationComponentEnabled(boolean)}.
* <p>
* <strong>Note</strong>: This method will initialize and use an internal {@link LocationEngine} when enabled.
*
* @param context the context
* @param style the proxy object for current map style. More info at {@link Style}
* @param styleRes the LocationComponent style res
* @deprecated use {@link LocationComponentActivationOptions.Builder} instead
*/
@Deprecated
public void activateLocationComponent(@NonNull Context context, @NonNull Style style, @StyleRes int styleRes) {
activateLocationComponent(context, style, LocationComponentOptions.createFromAttributes(context, styleRes));
}
/**
* This method initializes the component and needs to be called before any other operations are performed.
* Afterwards, you can manage component's visibility by {@link #setLocationComponentEnabled(boolean)}.
* <p>
* <strong>Note</strong>: This method will initialize and use an internal {@link LocationEngine} when enabled.
* </p>
*
* @param context the context
* @param style the proxy object for current map style. More info at {@link Style}
* @param options the options
* @deprecated use {@link LocationComponentActivationOptions.Builder} instead
*/
@Deprecated
public void activateLocationComponent(@NonNull Context context, @NonNull Style style,
@NonNull LocationComponentOptions options) {
initialize(context, style, false, options);
initializeLocationEngine(context);
applyStyle(options);
}
/**
* This method initializes the component and needs to be called before any other operations are performed.
* Afterwards, you can manage component's visibility by {@link #setLocationComponentEnabled(boolean)}.
*
* @param context the context
* @param style the proxy object for current map style. More info at {@link Style}
* @param locationEngine the engine, or null if you'd like to only force location updates
* @param styleRes the LocationComponent style res
* @deprecated use {@link LocationComponentActivationOptions.Builder} instead
*/
@Deprecated
public void activateLocationComponent(@NonNull Context context, @NonNull Style style,
@Nullable LocationEngine locationEngine, @StyleRes int styleRes) {
activateLocationComponent(context, style, locationEngine,
LocationComponentOptions.createFromAttributes(context, styleRes));
}
/**
* This method initializes the component and needs to be called before any other operations are performed.
* Afterwards, you can manage component's visibility by {@link #setLocationComponentEnabled(boolean)}.
*
* @param context the context
* @param style the proxy object for current map style. More info at {@link Style}
* @param locationEngine the engine, or null if you'd like to only force location updates
* @param locationEngineRequest the location request
* @param styleRes the LocationComponent style res
* @deprecated use {@link LocationComponentActivationOptions.Builder} instead
*/
@Deprecated
public void activateLocationComponent(@NonNull Context context, @NonNull Style style,
@Nullable LocationEngine locationEngine,
@NonNull LocationEngineRequest locationEngineRequest, @StyleRes int styleRes) {
activateLocationComponent(context, style, locationEngine, locationEngineRequest,
LocationComponentOptions.createFromAttributes(context, styleRes));
}
/**
* This method will show the location icon and enable the camera tracking the location.
*
* @param context the context
* @param style the proxy object for current map style. More info at {@link Style}
* @param locationEngine the engine
* @deprecated use {@link LocationComponentActivationOptions.Builder} instead
*/
@Deprecated
public void activateLocationComponent(@NonNull Context context, @NonNull Style style,
@Nullable LocationEngine locationEngine) {
activateLocationComponent(context, style, locationEngine, R.style.maplibre_LocationComponent);
}
/**
* This method will show the location icon and enable the camera tracking the location.
*
* @param context the context
* @param style the proxy object for current map style. More info at {@link Style}
* @param locationEngine the engine
* @param locationEngineRequest the location request
* @deprecated use {@link LocationComponentActivationOptions.Builder} instead
*/
@Deprecated
public void activateLocationComponent(@NonNull Context context, @NonNull Style style,
@Nullable LocationEngine locationEngine,
@NonNull LocationEngineRequest locationEngineRequest) {
activateLocationComponent(
context,
style,
locationEngine,
locationEngineRequest,
R.style.maplibre_LocationComponent);
}
/**
* This method initializes the component and needs to be called before any other operations are performed.
* Afterwards, you can manage component's visibility by {@link #setLocationComponentEnabled(boolean)}.
*
* @param locationEngine the engine, or null if you'd like to only force location updates
* @param style the proxy object for current map style. More info at {@link Style}
* @param options the options
* @deprecated use {@link LocationComponentActivationOptions.Builder} instead
*/
@Deprecated
public void activateLocationComponent(@NonNull Context context, @NonNull Style style,
@Nullable LocationEngine locationEngine,
@NonNull LocationComponentOptions options) {
initialize(context, style, false, options);
setLocationEngine(locationEngine);
applyStyle(options);
}
/**
* This method initializes the component and needs to be called before any other operations are performed.
* Afterwards, you can manage component's visibility by {@link #setLocationComponentEnabled(boolean)}.
*
* @param context the context
* @param style the proxy object for current map style. More info at {@link Style}
* @param locationEngine the engine, or null if you'd like to only force location updates
* @param locationEngineRequest the location request
* @param options the options
* @deprecated use {@link LocationComponentActivationOptions.Builder} instead
*/
@Deprecated
public void activateLocationComponent(@NonNull Context context, @NonNull Style style,
@Nullable LocationEngine locationEngine,
@NonNull LocationEngineRequest locationEngineRequest,
@NonNull LocationComponentOptions options) {
initialize(context, style, false, options);
setLocationEngineRequest(locationEngineRequest);
setLocationEngine(locationEngine);
applyStyle(options);
}
/**
* This method initializes the component and needs to be called before any other operations are performed.
* Afterwards, you can manage component's visibility by {@link #setLocationComponentEnabled(boolean)}.
@@ -503,7 +266,7 @@ public final class LocationComponent {
setLocationEngine(locationEngine);
} else {
if (activationOptions.useDefaultLocationEngine()) {
initializeLocationEngine(activationOptions.context());
setLocationEngine(LocationEngineDefault.INSTANCE.getDefaultLocationEngine(activationOptions.context()));
} else {
setLocationEngine(null);
}
@@ -1354,13 +1117,6 @@ public final class LocationComponent {
onLocationLayerStart();
}
private void initializeLocationEngine(@NonNull Context context) {
if (this.locationEngine != null) {
this.locationEngine.removeLocationUpdates(currentLocationEngineListener);
}
setLocationEngine(internalLocationEngineProvider.getBestLocationEngine(context, false));
}
private void updateCompassListenerState(boolean canListen) {
if (compassEngine != null) {
if (!canListen) {
@@ -1712,12 +1468,6 @@ public final class LocationComponent {
}
};
static class InternalLocationEngineProvider {
LocationEngine getBestLocationEngine(@NonNull Context context, boolean background) {
return LocationEngineProvider.getBestLocationEngine(context, background);
}
}
private void checkActivationState() {
if (!isComponentInitialized) {
throw new LocationComponentNotInitializedException();

View File

@@ -1,146 +0,0 @@
package com.mapbox.mapboxsdk.location.engine;
import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.content.Context;
import android.location.Location;
import android.os.Looper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationCallback;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationResult;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.location.Priority;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import java.util.Collections;
import java.util.List;
/**
* Wraps implementation of Fused Location Provider
*/
class GoogleLocationEngineImpl implements LocationEngineImpl<LocationCallback> {
private final FusedLocationProviderClient fusedLocationProviderClient;
@VisibleForTesting
GoogleLocationEngineImpl(FusedLocationProviderClient fusedLocationProviderClient) {
this.fusedLocationProviderClient = fusedLocationProviderClient;
}
GoogleLocationEngineImpl(@NonNull Context context) {
this.fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(context);
}
@NonNull
@Override
public LocationCallback createListener(LocationEngineCallback<LocationEngineResult> callback) {
return new GoogleLocationEngineCallbackTransport(callback);
}
@SuppressLint("MissingPermission")
@Override
public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback)
throws SecurityException {
GoogleLastLocationEngineCallbackTransport transport =
new GoogleLastLocationEngineCallbackTransport(callback);
fusedLocationProviderClient.getLastLocation().addOnSuccessListener(transport).addOnFailureListener(transport);
}
@SuppressLint("MissingPermission")
@Override
public void requestLocationUpdates(@NonNull LocationEngineRequest request,
@NonNull LocationCallback listener,
@Nullable Looper looper) throws SecurityException {
fusedLocationProviderClient.requestLocationUpdates(toGMSLocationRequest(request), listener, looper);
}
@SuppressLint("MissingPermission")
@Override
public void requestLocationUpdates(@NonNull LocationEngineRequest request,
@NonNull PendingIntent pendingIntent) throws SecurityException {
fusedLocationProviderClient.requestLocationUpdates(toGMSLocationRequest(request), pendingIntent);
}
@Override
public void removeLocationUpdates(@NonNull LocationCallback listener) {
if (listener != null) {
fusedLocationProviderClient.removeLocationUpdates(listener);
}
}
@Override
public void removeLocationUpdates(PendingIntent pendingIntent) {
if (pendingIntent != null) {
fusedLocationProviderClient.removeLocationUpdates(pendingIntent);
}
}
private static LocationRequest toGMSLocationRequest(LocationEngineRequest request) {
LocationRequest.Builder builder = new LocationRequest.Builder(request.getInterval());
builder.setMinUpdateIntervalMillis(request.getFastestInterval());
builder.setMinUpdateDistanceMeters(request.getDisplacement());
builder.setMaxUpdateDelayMillis(request.getMaxWaitTime());
builder.setPriority(toGMSLocationPriority(request.getPriority()));
return builder.build();
}
private static int toGMSLocationPriority(int enginePriority) {
switch (enginePriority) {
case LocationEngineRequest.PRIORITY_HIGH_ACCURACY:
return Priority.PRIORITY_HIGH_ACCURACY;
case LocationEngineRequest.PRIORITY_BALANCED_POWER_ACCURACY:
return Priority.PRIORITY_BALANCED_POWER_ACCURACY;
case LocationEngineRequest.PRIORITY_LOW_POWER:
return Priority.PRIORITY_LOW_POWER;
case LocationEngineRequest.PRIORITY_NO_POWER:
default:
return Priority.PRIORITY_PASSIVE;
}
}
private static final class GoogleLocationEngineCallbackTransport extends LocationCallback {
private final LocationEngineCallback<LocationEngineResult> callback;
GoogleLocationEngineCallbackTransport(LocationEngineCallback<LocationEngineResult> callback) {
this.callback = callback;
}
@Override
public void onLocationResult(LocationResult locationResult) {
super.onLocationResult(locationResult);
List<Location> locations = locationResult.getLocations();
if (!locations.isEmpty()) {
callback.onSuccess(LocationEngineResult.create(locations));
} else {
callback.onFailure(new Exception("Unavailable location"));
}
}
}
@VisibleForTesting
static final class GoogleLastLocationEngineCallbackTransport
implements OnSuccessListener<Location>, OnFailureListener {
private final LocationEngineCallback<LocationEngineResult> callback;
GoogleLastLocationEngineCallbackTransport(LocationEngineCallback<LocationEngineResult> callback) {
this.callback = callback;
}
@Override
public void onSuccess(Location location) {
callback.onSuccess(location != null ? LocationEngineResult.create(location) :
LocationEngineResult.create(Collections.<Location>emptyList()));
}
@Override
public void onFailure(@NonNull Exception e) {
callback.onFailure(e);
}
}
}

View File

@@ -0,0 +1,12 @@
package com.mapbox.mapboxsdk.location.engine
import android.content.Context
object LocationEngineDefault {
/**
* Returns the default `LocationEngine`.
*/
fun getDefaultLocationEngine(context: Context): LocationEngine {
return LocationEngineProxy(MapboxFusedLocationEngineImpl(context.applicationContext))
}
}

View File

@@ -11,7 +11,7 @@ import androidx.annotation.Nullable;
*
* @param <T> location listener object type
*/
interface LocationEngineImpl<T> {
public interface LocationEngineImpl<T> {
@NonNull
T createListener(LocationEngineCallback<LocationEngineResult> callback);

View File

@@ -1,62 +0,0 @@
package com.mapbox.mapboxsdk.location.engine;
import android.content.Context;
import androidx.annotation.NonNull;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import static com.mapbox.mapboxsdk.location.engine.Utils.checkNotNull;
import static com.mapbox.mapboxsdk.location.engine.Utils.isOnClasspath;
/**
* The main entry point for location engine integration.
*/
public final class LocationEngineProvider {
private static final String GOOGLE_LOCATION_SERVICES = "com.google.android.gms.location.LocationServices";
private static final String GOOGLE_API_AVAILABILITY = "com.google.android.gms.common.GoogleApiAvailability";
private LocationEngineProvider() {
// prevent instantiation
}
/**
* Returns instance to the best location engine, given the included libraries.
*
* @param context {@link Context}.
* @param background true if background optimized engine is desired (note: parameter deprecated)
* @return a unique instance of {@link LocationEngine} every time method is called.
* @since 1.0.0
*/
@NonNull
@Deprecated
public static LocationEngine getBestLocationEngine(@NonNull Context context, boolean background) {
return getBestLocationEngine(context);
}
/**
* Returns instance to the best location engine, given the included libraries.
*
* @param context {@link Context}.
* @return a unique instance of {@link LocationEngine} every time method is called.
* @since 1.1.0
*/
@NonNull
public static LocationEngine getBestLocationEngine(@NonNull Context context) {
checkNotNull(context, "context == null");
boolean hasGoogleLocationServices = isOnClasspath(GOOGLE_LOCATION_SERVICES);
if (isOnClasspath(GOOGLE_API_AVAILABILITY)) {
// Check Google Play services APK is available and up-to-date on this device
hasGoogleLocationServices &= GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context)
== ConnectionResult.SUCCESS;
}
return getLocationEngine(context, hasGoogleLocationServices);
}
private static LocationEngine getLocationEngine(Context context, boolean isGoogle) {
return isGoogle ? new LocationEngineProxy<>(new GoogleLocationEngineImpl(context.getApplicationContext())) :
new LocationEngineProxy<>(new MapboxFusedLocationEngineImpl(context.getApplicationContext()));
}
}

View File

@@ -12,7 +12,7 @@ import java.util.concurrent.ConcurrentHashMap;
import static com.mapbox.mapboxsdk.location.engine.Utils.checkNotNull;
class LocationEngineProxy<T> implements LocationEngine {
public class LocationEngineProxy<T> implements LocationEngine {
private final LocationEngineImpl<T> locationEngineImpl;
private Map<LocationEngineCallback<LocationEngineResult>, T> listeners;

View File

@@ -7,14 +7,10 @@ import android.location.LocationManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.gms.location.LocationResult;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static com.mapbox.mapboxsdk.location.engine.Utils.isOnClasspath;
/**
* A wrapper class representing location result from the location engine.
* <p>
@@ -23,8 +19,6 @@ import static com.mapbox.mapboxsdk.location.engine.Utils.isOnClasspath;
* @since 1.0.0
*/
public final class LocationEngineResult {
private static final String GOOGLE_PLAY_LOCATION_RESULT = "com.google.android.gms.location.LocationResult";
private final List<Location> locations;
private LocationEngineResult(List<Location> locations) {
@@ -95,16 +89,7 @@ public final class LocationEngineResult {
*/
@Nullable
public static LocationEngineResult extractResult(Intent intent) {
LocationEngineResult result = null;
if (isOnClasspath(GOOGLE_PLAY_LOCATION_RESULT)) {
result = extractGooglePlayResult(intent);
}
return result == null ? extractAndroidResult(intent) : result;
}
private static LocationEngineResult extractGooglePlayResult(Intent intent) {
LocationResult result = LocationResult.extractResult(intent);
return result != null ? LocationEngineResult.create(result.getLocations()) : null;
return extractAndroidResult(intent);
}
private static LocationEngineResult extractAndroidResult(Intent intent) {