Class GooglePlayServicesHelper


  • public final class GooglePlayServicesHelper
    extends java.lang.Object
    Helper to get GooglePlayServices data with introspection
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Integer getGooglePlayServicesAvailabilityInteger​(android.content.Context context)  
      static java.lang.String getGooglePlayServicesAvailabilityString​(java.lang.Integer availability)
      retrieve the google play services' isGooglePlayServicesAvailable result as a string
      static java.lang.Integer getGooglePlayServicesLibVersion​(android.content.Context context)
      retrieve the google play services version if the lib regardless if it is available on rutime or not
      static java.lang.String getInstancePushToken​(android.content.Context context, java.lang.String senderID)
      Get the instance token (not the instance id itself), usable with GCM
      static java.lang.String getPushToken​(android.content.Context context, java.lang.String senderID)
      Get the push token from GCM.
      static boolean isAdvertisingIDAvailable​(android.content.Context context)
      Check if the advertising ID is available by checking the version of the lib
      static java.lang.Integer isFCMAvailable​(android.content.Context context)
      Check if FCM is available
      static java.lang.Integer isInstanceIdPushAvailable​(android.content.Context context)
      Check if InstanceID based GCM is available
      static java.lang.Integer isPushAvailable​(android.content.Context context)
      Check if GCM is available
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GooglePlayServicesHelper

        public GooglePlayServicesHelper()
    • Method Detail

      • getGooglePlayServicesAvailabilityString

        public static java.lang.String getGooglePlayServicesAvailabilityString​(java.lang.Integer availability)
        retrieve the google play services' isGooglePlayServicesAvailable result as a string
        Parameters:
        availability -
        Returns:
        version of the lib if available, null if the lib is unavailable
      • getGooglePlayServicesAvailabilityInteger

        public static java.lang.Integer getGooglePlayServicesAvailabilityInteger​(android.content.Context context)
      • getGooglePlayServicesLibVersion

        public static java.lang.Integer getGooglePlayServicesLibVersion​(android.content.Context context)
        retrieve the google play services version if the lib regardless if it is available on rutime or not
        Parameters:
        context -
        Returns:
        version of the lib if available, null if the lib is not here
      • isAdvertisingIDAvailable

        public static boolean isAdvertisingIDAvailable​(android.content.Context context)
        Check if the advertising ID is available by checking the version of the lib
        Parameters:
        context -
        Returns:
      • isPushAvailable

        public static java.lang.Integer isPushAvailable​(android.content.Context context)
        Check if GCM is available
        Parameters:
        context -
        Returns:
        Integer errorID. The error's ID. 0 if the library is available both at integration and runtime. Can be null.
      • getPushToken

        public static java.lang.String getPushToken​(android.content.Context context,
                                                    java.lang.String senderID)
        Get the push token from GCM. Be careful, this method is synchronous and can take a long time.
        Parameters:
        context - Application context
        Returns:
        Push token or null if unavailable
      • isInstanceIdPushAvailable

        public static java.lang.Integer isInstanceIdPushAvailable​(android.content.Context context)
        Check if InstanceID based GCM is available
        Parameters:
        context -
        Returns:
        Integer errorID. The error's ID. 0 if the library is available both at integration and runtime. Can be null.
      • getInstancePushToken

        public static java.lang.String getInstancePushToken​(android.content.Context context,
                                                            java.lang.String senderID)
        Get the instance token (not the instance id itself), usable with GCM
      • isFCMAvailable

        public static java.lang.Integer isFCMAvailable​(android.content.Context context)
        Check if FCM is available
        Parameters:
        context -
        Returns:
        Integer errorID. The error's ID. 0 if the library is available both at integration and runtime. Can be null.