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 Jan 31, 2024
2 parents d7ffed0 + 4aa7cd7 commit d146308
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 d146308

Please sign in to comment.