public class

PlayServicesUtils

extends Object
java.lang.Object
   ↳ com.urbanairship.google.PlayServicesUtils

Class Overview

A utility class to help verify and resolve Google Play services issues.

Summary

Constants
int MISSING_PLAY_SERVICE_DEPENDENCY Error code returned by isGooglePlayServicesDependencyAvailable() when the Google Play services dependency is missing.
Public Constructors
PlayServicesUtils()
Public Methods
static void handleAnyPlayServicesError(Context context)
Checks and handles any user recoverable Google Play services errors.
static boolean isFusedLocationDependencyAvailable()
Checks if Google Play services dependency is available for Fused Location.
static boolean isGoogleAdsDependencyAvailable()
Checks if Google Play services dependency is available for advertising ID tracking.
static int isGooglePlayServicesAvailable(Context context)
Verifies that Google Play services dependency is available and the Google Play services version required for the application is installed and enabled on the device.
static boolean isGooglePlayServicesDependencyAvailable()
Checks if Google Play services dependency is available.
static boolean isGooglePlayStoreAvailable(Context context)
Checks if the Google Play Store package is installed on the device.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int MISSING_PLAY_SERVICE_DEPENDENCY

Error code returned by isGooglePlayServicesDependencyAvailable() when the Google Play services dependency is missing.

Constant Value: -1 (0xffffffff)

Public Constructors

public PlayServicesUtils ()

Public Methods

public static void handleAnyPlayServicesError (Context context)

Checks and handles any user recoverable Google Play services errors.

If a user recoverable error is encountered, a PlayServicesErrorActivity will be launched to display any resolution dialog provided by Google Play services.

Parameters
context The application context.

public static boolean isFusedLocationDependencyAvailable ()

Checks if Google Play services dependency is available for Fused Location.

Returns
  • true if available, otherwise false.

public static boolean isGoogleAdsDependencyAvailable ()

Checks if Google Play services dependency is available for advertising ID tracking.

Returns
  • true if available, otherwise false.

public static int isGooglePlayServicesAvailable (Context context)

Verifies that Google Play services dependency is available and the Google Play services version required for the application is installed and enabled on the device.

This method is a wrapper around isGooglePlayServicesAvailable(android.content.Context) but with an additional check if the dependency is also available.

Parameters
context The application context.
Returns

public static boolean isGooglePlayServicesDependencyAvailable ()

Checks if Google Play services dependency is available.

Returns
  • true if available, otherwise false.

public static boolean isGooglePlayStoreAvailable (Context context)

Checks if the Google Play Store package is installed on the device.

Parameters
context The application context.
Returns
  • true if Google Play Store package is installed on the device, otherwise false