java.lang.Object | ||
↳ | com.kinvey.android.push.AbstractPush | |
↳ | com.kinvey.android.push.GCMPush |
This functionality can be accessed through the push()
convenience method.
This class manages GCM Push for the current logged in user. Use `gcm.enabled=true` in the `kinvey.properties` file to enable GCM.
sample usage:kinveyClient.push().initialize(getApplicationContext());
This code snippet will enable push notifications through GCM for the current logged in user.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
class | GCMPush.PushConfig | This class is used to maintain metadata about the current GCM push configuration in the User collection. | |||||||||
class | GCMPush.PushConfigField | Manages ids and notificationKeys for PushConfig
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
public static String[] | senderIDs |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
GCMPush(Client client, boolean inProduction, String... senderIDs) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
disablePush()
Unregisters the current user with GCM
Unregistration is asynchronous, so use the `KinveyGCMService` to receive notification when unregistration has completed.
| ||||||||||
void |
disablePushViaRest(KinveyClientCallback callback, String deviceID)
Async wrapper for disabling push notifications for the current user
| ||||||||||
void |
enablePushViaRest(KinveyClientCallback callback, String deviceID)
Async wrapper for enabling push notification for the current user
| ||||||||||
String |
getPushId()
Get the Registration ID from GCM for the Client's current application context.
| ||||||||||
String[] |
getSenderIDs()
Get a list of all sender IDs as an array
| ||||||||||
GCMPush |
initialize(Application currentApp)
Initialize GCM by registering the current user with both GCM as well as your backend at Kinvey.
| ||||||||||
boolean |
isInProduction()
Is GCM Push configured for production or a dev environment?
| ||||||||||
boolean |
isPushEnabled()
Check to see if the current user is registered for GCM.
| ||||||||||
void | registerWithKinvey(String gcmRegID, boolean register) |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Unregisters the current user with GCM Unregistration is asynchronous, so use the `KinveyGCMService` to receive notification when unregistration has completed.
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 |
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 |
Get the Registration ID from GCM for the Client's current application context. Note if the current user is not registered, the registration ID will be an empty string.
Get a list of all sender IDs as an array
Initialize GCM by registering the current user with both GCM 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 `KinveyGCMService` which will handle any responses.
currentApp | - The current valid application context. |
---|
Is GCM Push configured for production or a dev environment?
Check to see if the current user is registered for GCM. This checks both with GCM directly as well as with a Kinvey backend. As registration occurs asynchronously, ensure your `KinveyGCMService` has received the onRegister call first.