Skip to content

Commit

Permalink
Update cancelLocationUpdates to check for googleApiClient connection …
Browse files Browse the repository at this point in the history
…instead of try/catch
  • Loading branch information
jennantilla authored and jinliu9508 committed Jan 31, 2024
1 parent 72108b3 commit 4aa7cd7
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,10 @@ internal class GmsLocationController(
googleApiClient: GoogleApiClient,
locationListener: LocationListener,
) {
try {
if (googleApiClient.isConnected) {
LocationServices.FusedLocationApi.removeLocationUpdates(googleApiClient, locationListener)
} catch (e: IllegalStateException) {
Logging.warn("Caught IllegalStateException in cancelLocationUpdates", e)
} else {
Logging.warn("GoogleApiClient is not connected. Unable to cancel location updates.")
}
}

Expand Down

0 comments on commit 4aa7cd7

Please sign in to comment.