Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions geolocator_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 5.0.1+1

- Bump `androidx.core:core` to version 1.16.0
- Fixes `location service on the device is disabled` bug on Wear OS

## 5.0.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.baseflow.geolocator.errors.ErrorCallback;
import com.baseflow.geolocator.errors.ErrorCodes;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.common.api.CommonStatusCodes;
import com.google.android.gms.common.api.ResolvableApiException;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationAvailability;
Expand Down Expand Up @@ -240,6 +241,7 @@ public void startPositionUpdates(
locationSettingsResponse -> requestPositionUpdates(this.locationOptions))
.addOnFailureListener(
e -> {
Log.w(TAG, "checkLocationSettings error", e);
if (e instanceof ResolvableApiException) {
// When we don't have an activity return an error code explaining the
// location services are not enabled
Expand All @@ -264,7 +266,9 @@ public void startPositionUpdates(
} else {
ApiException ae = (ApiException) e;
int statusCode = ae.getStatusCode();
if (statusCode == LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE) {
// checkLocationSettings returns DEVELOPER_ERROR on Wear OS.
if (statusCode == LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE
|| statusCode == CommonStatusCodes.DEVELOPER_ERROR) {
requestPositionUpdates(this.locationOptions);
} else {
// This should not happen according to Android documentation but it has been
Expand Down