PushMessaging

This class provides utility functions related to push notifications, such as methods for registration, unregistration, and storage and retrieval of push notification registration information from a private shared preference file.

Properties

Functions

Link copied to clipboard

Clears the stored registration information.

Link copied to clipboard

Clears the stored SFDC device ID.

Link copied to clipboard

Get the app unique name for firebase

Link copied to clipboard
fun getDeviceId(context: Context, account: UserAccount?): String?

Returns the SFDC registration ID for the specified user account.

Link copied to clipboard

Returns Salesforce notifications types for the provided user account.

Link copied to clipboard

Returns the current registration ID, or null, if registration hasn't taken place yet.

Link copied to clipboard
fun isInProgress(context: Context, account: UserAccount?): Boolean

Returns whether push notification registration/un-registration is in progress.

Link copied to clipboard

Returns whether the specified user account is currently registered or not.

Link copied to clipboard

Returns whether the user account is registered with SFDC or not.

Link copied to clipboard
Link copied to clipboard
fun register(context: Context, account: UserAccount?)
fun register(context: Context, account: UserAccount?, recreateKey: Boolean)

Initiates push registration, if the application is not already registered. Otherwise, this method initiates registration/re-registration to the SFDC endpoint, in order to keep it alive, or to register a new account that just logged in.

Link copied to clipboard

Initiates push registration against the SFDC endpoint.

Link copied to clipboard
fun setLastRegistrationTime(context: Context, lastRegistrationTime: Long, account: UserAccount?)

Sets the last time SFDC registration was successful for the specified user account.

Link copied to clipboard
fun setRegistrationId(context: Context, registrationId: String?, account: UserAccount?)

Stores the GCM registration ID, and resets back off time.

Link copied to clipboard
fun setRegistrationInfo(context: Context, registrationId: String?, deviceId: String?, account: UserAccount?)

Stores the current registration information, and resets the backoff time.

Link copied to clipboard
fun unregister(context: Context, account: UserAccount?, isLastAccount: Boolean)

Performs SFDC un-registration from push notifications for the specified user account. Performs GCM un-registration only if this is the last account being logged out.