Created
March 30, 2017 07:45
-
-
Save smoothdvd/bd4a8283ee9ad23ebd3b906c0bcea9e9 to your computer and use it in GitHub Desktop.
Check the device to make sure it has the Google Play Services APK. If it doesn't, display a dialog that allows users to download the APK from the Google Play Store or enable it in the device's system settings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Check the device to make sure it has the Google Play Services APK. If | |
* it doesn't, display a dialog that allows users to download the APK from | |
* the Google Play Store or enable it in the device's system settings. | |
*/ | |
private boolean checkPlayServices() { | |
GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance(); | |
int resultCode = apiAvailability.isGooglePlayServicesAvailable(this); | |
if (resultCode != ConnectionResult.SUCCESS) { | |
if (apiAvailability.isUserResolvableError(resultCode)) { | |
apiAvailability.getErrorDialog(this, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST) | |
.show(); | |
} else { | |
Log.i(TAG, "This device is not supported."); | |
finish(); | |
} | |
return false; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment