I read the official docs and it confuses me. What is difference between
GooglePlayServicesRepairableException
and GooglePlayServicesNotAvailableException
. When they are thrown? How to handle these errors? How to show a dialog to user, where he can enable/update/install the services. e.t.c.
private void startLocationPicker() {
try {
new PlacePicker.IntentBuilder().build(this);
} catch (GooglePlayServicesRepairableException e) {
} catch (GooglePlayServicesNotAvailableException e) {
}
}
As mentioned in the GooglePlayServicesRepairableException docs:
GooglePlayServicesRepairableExceptions are special instances of UserRecoverableExceptions which are thrown when Google Play Services is not installed, up-to-date, or enabled. In these cases, client code can use getConnectionStatusCode() in conjunction 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 has an error code which can be used with getErrorDialog()
, although I'd encourage you to look over all of the methods available in GoogleApiAvailability.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With