Skip to content

Commit

Permalink
Remove com.google.android.gms.location (maplibre#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
louwers committed Feb 13, 2023
1 parent 4a34caa commit 789fbf5
Show file tree
Hide file tree
Showing 17 changed files with 79 additions and 766 deletions.
7 changes: 6 additions & 1 deletion platform/android/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ MapLibre welcomes participation and contributions from everyone. Please read [`C

* Add your pull request...

## 10.0.0 - February 10, 2023
## 10.0.0 - February 14, 2023

### ✨ Features and improvements

* Breaking: Changed resourcePrefix to `maplibre_` from `mapbox_` [647](https://github.com/maplibre/maplibre-gl-native/pull/647) and renamed resources accordingly. Note that this is a breaking change since the names of public resources were renamed as well. Replaced Mapbox logo with MapLibre logo.
* GMS location: Replace new LocationRequest() with LocationRequest.Builder, and LocationRequest.PRIORITY_X with Priority.PRIORITY_X ([620](https://github.com/maplibre/maplibre-gl-native/pull/620))
* Breaking: several deprecated overloads of `LocationComponent.activateLocationComponent` were removed. Use `LocationComponentActivationOptions.Builder` instead.
* Breaking: the `LocationEngine` implemented with Google Location Services has been removed to make MapLibre GL Native for Android fully FLOSS ([#379](https://github.com/maplibre/maplibre-gl-native/issues/379)). To migrate:
* Include the source code of the removed `[GoogleLocationEngineImpl](https://github.com/maplibre/maplibre-gl-native/blob/main/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/GoogleLocationEngineImpl.java)` in your source tree.
* Pass an instance of `LocationEngine` based on `GoogleLocationEngineImpl` to `LocationComponentActivationOptions.Builder.locationEngine`. Refer to how this was done in the now-removed `[LocationEngineProvider](https://github.com/maplibre/maplibre-gl-native/blob/68d58d6f6f453d5c6cc0fa92fcc6c6cfe0cf967f/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineProvider.java#L59)`.
* The static `LocationEngineResult.extractResult` can no longer extract a `LocationEngineResult` from a Google Play intent. To migrate, include and use the [previous implementation](https://github.com/maplibre/maplibre-gl-native/blob/ea234edf67bb3aec75f077e15c1c30c99756b926/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineResult.java#L97) in your source tree.

### 🐞 Bug fixes

Expand Down
1 change: 0 additions & 1 deletion platform/android/MapboxGLAndroidSDK/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ dependencies {
implementation dependenciesList.supportAnnotations
implementation dependenciesList.supportFragmentV4
implementation dependenciesList.okhttp3
implementation dependenciesList.gmsLocation
implementation dependenciesList.timber
implementation dependenciesList.interpolator

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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))
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
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;
Expand All @@ -23,8 +21,6 @@
* @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) {
Expand Down Expand Up @@ -95,16 +91,7 @@ public List<Location> getLocations() {
*/
@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) {
Expand Down
Loading

0 comments on commit 789fbf5

Please sign in to comment.