API Reference

com.kinvey.android.push

Class FCMPush

  • AbstractPush
    • com.kinvey.android.push.FCMPush


  • public class FCMPush
    extends AbstractPush

    This functionality can be accessed through the Client.push ()} convenience method.

    This class manages FCM Push for the current logged in user. Use `fcm.enabled=true` in the `kinvey.properties` file to enable FCM.

    sample usage:
     kinveyClient.push().initialize(getApplicationContext()); 

    This code snippet will enable push notifications through FCM for the current logged in user.

    See Also:
    Client.push
    • Field Detail

      • senderIDs

        public static java.lang.String[] senderIDs
      • shared_pref

        public static java.lang.String shared_pref
      • pref_regid

        public static java.lang.String pref_regid
    • Constructor Detail

      • FCMPush

        public FCMPush()
    • Method Detail

      • initialize

        public FCMPush initialize()

        Initialize FCM by registering the current user with both FCM as well as your backend at Kinvey. Note these operations are performed asynchronously, however there is no callback. Instead, updates are delegated to your custom `KinveyFCMService` which will handle any responses.

        Returns:
        an instance of FCM push, initialized for the current user.
      • registerWithKinvey

        public void registerWithKinvey()
      • getPushId

        public java.lang.String getPushId()

        Get the InstanceID from FCM for the Client's current application context. Note if the current user is not registered, the registration ID will be an empty string.

        Returns:
        - the current user's FCM InstanceID or an empty string ""
      • isPushEnabled

        public boolean isPushEnabled()

        Check to see if the current user is registered for FCM. This checks both with FCM directly as well as with a Kinvey backend.

        Returns:
        true if current user is registered, false if they are not.
      • disablePush

        public void disablePush()

        Unregisters the current user with FCM Unregistration is asynchronous, so use the `KinveyFCMService` to receive notification when unregistration has completed.

      • isInProduction

        public boolean isInProduction()

        Is FCM Push configured for production or a dev environment?

        Returns:
        true if in production mode, false if not
      • getSenderIDs

        public java.lang.String[] getSenderIDs()

        Get a list of all sender IDs as an array

        Returns:
        an array of sender IDs
      • enablePushViaRest

        public void enablePushViaRest()
      • disablePushViaRest

        public void disablePushViaRest()