File tree Expand file tree Collapse file tree
android/src/main/java/com/baseflow/geolocator/location Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11## NEXT
22
33- Fixes PlatformException in example app for Android 14 (API level 34) versions and newer by updating manifest permissions.
4+ - Prevented crash by checking ` isSuccessful ` before calling ` getResult() ` in location settings check.
45
56## 5.0.1+1
67
Original file line number Diff line number Diff line change @@ -167,17 +167,17 @@ public void isLocationServiceEnabled(LocationServiceListener listener) {
167167 (response ) -> {
168168 if (!response .isSuccessful ()) {
169169 listener .onLocationServiceError (ErrorCodes .locationServicesDisabled );
170- }
171-
172- LocationSettingsResponse lsr = response .getResult ();
173- if (lsr != null ) {
174- LocationSettingsStates settingsStates = lsr .getLocationSettingsStates ();
175- boolean isGpsUsable = settingsStates != null && settingsStates .isGpsUsable ();
176- boolean isNetworkUsable =
177- settingsStates != null && settingsStates .isNetworkLocationUsable ();
178- listener .onLocationServiceResult (isGpsUsable || isNetworkUsable );
179170 } else {
180- listener .onLocationServiceError (ErrorCodes .locationServicesDisabled );
171+ LocationSettingsResponse lsr = response .getResult ();
172+ if (lsr != null ) {
173+ LocationSettingsStates settingsStates = lsr .getLocationSettingsStates ();
174+ boolean isGpsUsable = settingsStates != null && settingsStates .isGpsUsable ();
175+ boolean isNetworkUsable =
176+ settingsStates != null && settingsStates .isNetworkLocationUsable ();
177+ listener .onLocationServiceResult (isGpsUsable || isNetworkUsable );
178+ } else {
179+ listener .onLocationServiceError (ErrorCodes .locationServicesDisabled );
180+ }
181181 }
182182 });
183183 }
You can’t perform that action at this time.
0 commit comments