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:
This code snippet will enable push notifications through FCM for the current logged in user.
Client.push
Modifier and Type | Class and Description |
---|---|
static class |
FCMPush.Companion |
static class |
FCMPush.PushConfig
This class is used to maintain metadata about the current GCM push configuration in the User collection.
|
static class |
FCMPush.PushConfigField
Manages ids and notificationKeys for
PushConfig |
AbstractPush.PushRegistration, AbstractPush.RegisterPush, AbstractPush.UnregisterPush
Modifier and Type | Field and Description |
---|---|
static FCMPush.Companion |
Companion |
static java.lang.String |
PREF_REG_ID |
static java.lang.String |
SHARED_PREF |
REGISTER_PUSH_REST_PATH, TAG, UNREGISTER_PUSH_REST_PATH
Constructor and Description |
---|
FCMPush(Client<?> client,
boolean inProduction,
java.lang.String[] senderIDs)
This functionality can be accessed through the
Client.push ()} convenience method. |
Modifier and Type | Method and Description |
---|---|
void |
disablePush()
Unregisters the current user with FCM
|
void |
disablePushViaRest(com.kinvey.java.core.KinveyClientCallback<java.lang.Object> callback,
java.lang.String deviceID)
Async wrapper for disabling push notifications for the current user
|
void |
enablePushViaRest(com.kinvey.java.core.KinveyClientCallback<java.lang.Object> callback,
java.lang.String deviceID)
Async wrapper for enabling push notification for the current user
|
java.lang.String |
getPushId()
Get the InstanceID from FCM for the Client's current application context.
|
java.lang.String[] |
getSenderIDs()
Get a list of all sender IDs as an array
|
FCMPush |
initialize(android.app.Application currentApp)
Initialize FCM by registering the current user with both FCM as well as your backend at Kinvey.
|
boolean |
isInProduction()
Is FCM Push configured for production or a dev environment?
|
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.
|
void |
registerWithKinvey(java.lang.String fcmRegID,
boolean register) |
void |
setInProduction(boolean p)
Is FCM Push configured for production or a dev environment?
|
void |
setSenderIDs(java.lang.String[] p)
Get a list of all sender IDs as an array
|
createRegisterPushRequest, createUnregisterPushRequest, disablePush, disablePushViaRest, enablePushViaRest, getClient, getPushId, getPushServiceClass, getSenderIDs, initialize, isInProduction, isPushEnabled, setClient, setInProduction, setPushServiceClass, setSenderIDs
public static java.lang.String SHARED_PREF
public static java.lang.String PREF_REG_ID
public static FCMPush.Companion Companion
public FCMPush(Client<?> client, boolean inProduction, java.lang.String[] senderIDs)
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:
This code snippet will enable push notifications through FCM for the current logged in user.
Client.push
public FCMPush initialize(android.app.Application currentApp)
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.
currentApp
- The current valid application context.
public void registerWithKinvey(java.lang.String fcmRegID, boolean register)
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.
the current user's FCM InstanceID or an empty string ""
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.
public void disablePush()
Unregisters the current user with FCM
Unregistration is asynchronous, so use the KinveyFCMService
to receive notification when unregistration has completed.
public java.lang.String[] getSenderIDs()
Get a list of all sender IDs as an array
public void setSenderIDs(java.lang.String[] p)
Get a list of all sender IDs as an array
public void enablePushViaRest(com.kinvey.java.core.KinveyClientCallback<java.lang.Object> callback, java.lang.String deviceID)
Async wrapper for enabling push notification for the current user
callback
- a callback with results of registration
deviceID
- the current device's unique id from GCM
public void disablePushViaRest(com.kinvey.java.core.KinveyClientCallback<java.lang.Object> callback, java.lang.String deviceID)
Async wrapper for disabling push notifications for the current user
callback
- a callback with results of unregistration
deviceID
- the current device's unique id from GCM
public boolean isInProduction()
Is FCM Push configured for production or a dev environment?
public void setInProduction(boolean p)
Is FCM Push configured for production or a dev environment?