Skip to content

Commit

Permalink
Merge pull request #1940 from OneSignal/fix/catch_exception_for_locat…
Browse files Browse the repository at this point in the history
…ion_lib

Fix: Catch IllegalStateException on call to Google's location library
  • Loading branch information
jennantilla authored and jinliu9508 committed Feb 6, 2024
2 parents dd41509 + 4c45a24 commit 58d4bfa
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,11 @@ internal class GmsLocationController(
googleApiClient: GoogleApiClient,
locationListener: LocationListener,
) {
LocationServices.FusedLocationApi.removeLocationUpdates(googleApiClient, locationListener)
if (googleApiClient.isConnected) {
LocationServices.FusedLocationApi.removeLocationUpdates(googleApiClient, locationListener)
} else {
Logging.warn("GoogleApiClient is not connected. Unable to cancel location updates.")
}
}

fun requestLocationUpdates(
Expand Down

0 comments on commit 58d4bfa

Please sign in to comment.