How to handle GooglePlayServicesRepairableException and GooglePlayServicesNotAvailableException

I read the official docs and that bothers me. What is the difference between GooglePlayServicesRepairableException and GooglePlayServicesNotAvailableException . When are they thrown? How to handle these errors? How to show the dialog to the user, where he can enable / update / install services. etc

 private void startLocationPicker() { try { new PlacePicker.IntentBuilder().build(this); } catch (GooglePlayServicesRepairableException e) { } catch (GooglePlayServicesNotAvailableException e) { } } 
+5
source share
1 answer

As mentioned in GooglePlayServicesRepairableException Docs :

GooglePlayServicesRepairableExceptions are special instances of UserRecoverableException that are thrown when Google Play services are not installed, updated, or activated. In these cases, client code can use getConnectionStatusCode () in combination with getErrorDialog (android.app.Activity, int, int) to provide users with a localized dialog that will allow users to install, update, or otherwise enable Google Play services.

GooglePlayServicesNotAvailableException also contains an error code that can be used with getErrorDialog() , although I would recommend that you look at all the methods available in GoogleApiAvailability .

+5
source

All Articles