java.lang.Object | |
↳ | com.google.android.gms.common.GooglePlayServicesUtil |
Utility class for verifying that the Google Play services APK is available and
up-to-date on this device. The same checks are performed if one uses
AdvertisingIdClient
or
GoogleAuthUtil
to connect to the service.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | GMS_ERROR_DIALOG | ||||||||||
String | GOOGLE_PLAY_SERVICES_PACKAGE |
This constant is deprecated.
Use GOOGLE_PLAY_SERVICES_PACKAGE instead.
|
|||||||||
String | GOOGLE_PLAY_STORE_PACKAGE | Package name for Google Play Store. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
GOOGLE_PLAY_SERVICES_VERSION_CODE |
This field is deprecated.
Use GOOGLE_PLAY_SERVICES_VERSION_CODE instead.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This method is deprecated.
Use
getErrorDialog(Activity, int, int) instead.
| |||||||||||
This method is deprecated.
Use
getErrorDialog(Activity, int, int, OnCancelListener) instead.
| |||||||||||
This method is deprecated.
Use
getErrorResolutionPendingIntent(Context, ConnectionResult) instead.
| |||||||||||
This method is deprecated.
Use
getErrorString(int) instead.
| |||||||||||
This method is deprecated.
Use
getOpenSourceSoftwareLicenseInfo(Context) instead.
| |||||||||||
This gets the Context object of the Buddy APK.
| |||||||||||
This gets the Resources object of the Buddy APK.
| |||||||||||
This method is deprecated.
Use
GoogleApiAvailability#isGooglePlayServicesAvailable(Context) instead.
| |||||||||||
This method is deprecated.
Use
isUserResolvableError(int) instead.
| |||||||||||
This method is deprecated.
Use
showErrorDialogFragment(Activity, int, int, OnCancelListener) instead.
| |||||||||||
This method is deprecated.
Use
showErrorDialogFragment(Activity, int, int) instead.
| |||||||||||
This method is deprecated.
Use
showErrorNotification(Context, int) instead.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
This constant is deprecated.
Use GOOGLE_PLAY_SERVICES_PACKAGE
instead.
Package name for Google Play services.
Package name for Google Play Store.
This field is deprecated.
Use GOOGLE_PLAY_SERVICES_VERSION_CODE
instead.
Google Play services client library version (declared in library's AndroidManifest.xml android:versionCode).
This method is deprecated.
Use getErrorDialog(Activity, int, int)
instead.
Returns a dialog to address the provided errorCode. The returned dialog displays a localized message about the error and upon user confirmation (by tapping on dialog) will direct them to the Play Store if Google Play services is out of date or missing, or to system settings if Google Play services is disabled on the device.
Parameters | |
---|---|
errorCode |
int :
error code returned by isGooglePlayServicesAvailable(Context) call.
If errorCode is SUCCESS then null is returned. |
activity |
Activity :
parent activity for creating the dialog, also used for identifying language
to display dialog in. |
requestCode |
int :
The requestCode given when calling startActivityForResult. |
Returns | |
---|---|
Dialog |
This method is deprecated.
Use getErrorDialog(Activity, int, int, OnCancelListener)
instead.
Returns a dialog to address the provided errorCode. The returned dialog displays a localized message about the error and upon user confirmation (by tapping on dialog) will direct them to the Play Store if Google Play services is out of date or missing, or to system settings if Google Play services is disabled on the device.
Parameters | |
---|---|
errorCode |
int :
error code returned by isGooglePlayServicesAvailable(Context) call.
If errorCode is SUCCESS then null is returned. |
activity |
Activity :
parent activity for creating the dialog, also used for identifying language
to display dialog in. |
requestCode |
int :
The requestCode given when calling startActivityForResult. |
cancelListener |
DialogInterface.OnCancelListener :
The DialogInterface.OnCancelListener to invoke if the dialog is
canceled. |
Returns | |
---|---|
Dialog |
This method is deprecated.
Use getErrorResolutionPendingIntent(Context, ConnectionResult)
instead.
Returns a PendingIntent to address the provided errorCode. It will direct them to one of the following places to either the Play Store if Google Play services is out of date or missing, or system settings if Google Play services is disabled on the device.
Parameters | |
---|---|
errorCode |
int :
error code returned by isGooglePlayServicesAvailable(Context) call.
If errorCode is SUCCESS then null is returned. |
context |
Context :
parent context for creating the PendingIntent. |
requestCode |
int :
The requestCode given when calling startActivityForResult. |
Returns | |
---|---|
PendingIntent |
This method is deprecated.
Use getErrorString(int)
instead.
Returns a human-readable string of the error code returned from
isGooglePlayServicesAvailable(Context)
.
Parameters | |
---|---|
errorCode |
int
|
Returns | |
---|---|
String |
This method is deprecated.
Use getOpenSourceSoftwareLicenseInfo(Context)
instead.
Returns the open source software license information for the Google Play services application, or null if Google Play services is not available on this device.
Parameters | |
---|---|
context |
Context
|
Returns | |
---|---|
String |
This gets the Context object of the Buddy APK. This loads the Buddy APK code from the Buddy APK into memory. This returned context can be used to create classes and obtain resources defined in the Buddy APK.
Parameters | |
---|---|
context |
Context
|
Returns | |
---|---|
Context |
The Context object of the Buddy APK or null if the Buddy APK is not installed on the device. |
This gets the Resources object of the Buddy APK.
Parameters | |
---|---|
context |
Context
|
Returns | |
---|---|
Resources |
The Resources object of the Buddy APK or null if the Buddy APK is not installed on the device. |
This method is deprecated.
Use GoogleApiAvailability#isGooglePlayServicesAvailable(Context)
instead.
Verifies that Google Play services is installed and enabled on this device, and that the version installed on this device is no older than the one required by this client.
Parameters | |
---|---|
context |
Context
|
Returns | |
---|---|
int |
status code indicating whether there was an error. Can be one of following in
ConnectionResult : SUCCESS, SERVICE_MISSING,
SERVICE_VERSION_UPDATE_REQUIRED, SERVICE_DISABLED, SERVICE_INVALID |
This method is deprecated.
Use isUserResolvableError(int)
instead.
Determines whether an error is user-recoverable. If true, proceed by calling
getErrorDialog(int, Activity, int)
and showing the dialog.
Parameters | |
---|---|
errorCode |
int :
error code returned by isGooglePlayServicesAvailable(Context) , or
returned to your application via
onConnectionFailed(ConnectionResult) |
Returns | |
---|---|
boolean |
true if the error is recoverable with
getErrorDialog(int, Activity, int) |
This method is deprecated.
Use showErrorDialogFragment(Activity, int, int, OnCancelListener)
instead.
Display a DialogFragment for an error code returned by
isGooglePlayServicesAvailable(Context)
.
Parameters | |
---|---|
errorCode |
int :
error code returned by
isGooglePlayServicesAvailable(Context) call. If
errorCode is SUCCESS then this
does nothing |
activity |
Activity :
parent activity for creating the dialog, also used for
identifying language to display dialog in. |
requestCode |
int :
The requestCode given when calling
startActivityForResult. |
cancelListener |
DialogInterface.OnCancelListener :
The DialogInterface.OnCancelListener to
invoke if the dialog is canceled. |
Returns | |
---|---|
boolean |
true if the dialog is shown, false otherwise. |
Throws | |
---|---|
RuntimeException |
if API level is below 11 and activity is not a
FragmentActivity . |
Parameters | |
---|---|
errorCode |
int
|
activity |
Activity
|
fragment |
Fragment
|
requestCode |
int
|
cancelListener |
DialogInterface.OnCancelListener
|
Returns | |
---|---|
boolean |
This method is deprecated.
Use showErrorDialogFragment(Activity, int, int)
instead.
Display a DialogFragment for an error code returned by
isGooglePlayServicesAvailable(Context)
.
Parameters | |
---|---|
errorCode |
int :
error code returned by
isGooglePlayServicesAvailable(Context) call. If
errorCode is SUCCESS then this
does nothing. |
activity |
Activity :
parent activity for creating the dialog, also used for
identifying language to display dialog in. |
requestCode |
int :
The requestCode given when calling
startActivityForResult. |
Returns | |
---|---|
boolean |
true if the dialog is shown, false otherwise |
Throws | |
---|---|
RuntimeException |
if API level is below 11 and activity is not a
FragmentActivity . |
This method is deprecated.
Use showErrorNotification(Context, int)
instead.
Displays a notification relevant to the provided error code. This method is similar to
getErrorDialog(int, android.app.Activity, int)
, but is provided for background tasks
that cannot or shouldn't display dialogs.
Parameters | |
---|---|
errorCode |
int :
error code returned by isGooglePlayServicesAvailable(Context) call.
If errorCode is SUCCESS then null is returned. |
context |
Context :
used for identifying language to display dialog in as well as accessing the
NotificationManager . |