With the constantly changing nature of Google APIs, your users are likely to attempt to use your application, but not be able to because their files are out of date. We can use the GoogleApiAvailability
library to display a dialog to help the user resolve the problem.
We'll continue with the previous recipe and add code to the onConnectionFailed()
callback. We'll use the error result to display additional information to the user to resolve their problem.
Create a new project in Android Studio and call it HandleGoogleAPIError
. Use the default Phone & Tablet
options, and select Empty Activity
when prompted for Activity Type
. Once you've created the project, add the Google Play library reference to the project dependencies. (See the previous recipe steps.)