android-components / mozilla.components.feature.push / AutoPushFeature

AutoPushFeature

class AutoPushFeature : PushProcessor (source)

A implementation of a PushProcessor that should live as a singleton by being installed in the Application’s onCreate. It receives messages from a service and forwards them to be decrypted and routed.

Listen for subscription information changes for each registered PushType:

Listen also for push messages for each registered PushType:

Constructors

| Name | Summary | |—|—| | <init> | AutoPushFeature(context: <ERROR CLASS>, service: PushService, config: PushConfig, coroutineContext: CoroutineContext = Executors.newSingleThreadExecutor().asCoroutineDispatcher(), connection: PushConnection = RustPushConnection( senderId = config.senderId, serverHost = config.serverHost, socketProtocol = config.protocol, serviceType = config.serviceType, databasePath = File(context.filesDir, DB_NAME).canonicalPath ))
A implementation of a PushProcessor that should live as a singleton by being installed in the Application’s onCreate. It receives messages from a service and forwards them to be decrypted and routed. |

Functions

Name Summary
forceRegistrationRenewal fun forceRegistrationRenewal(): Unit
Deletes the registration token locally so that it forces the service to get a new one the next time hits it’s messaging server.
initialize fun initialize(): Unit
Starts the push service provided.
onError fun onError(error: PushError): Unit
An error has occurred.
onMessageReceived fun onMessageReceived(message: EncryptedPushMessage): Unit
New encrypted messages received from a supported push messaging service.
onNewToken fun onNewToken(newToken: String): Unit
New registration tokens are received and sent to the Autopush server which also performs subscriptions for each push type and notifies the subscribers.
registerForPushMessages fun registerForPushMessages(type: PushType, observer: Observer<PushType, String>, owner: LifecycleOwner = ProcessLifecycleOwner.get(), autoPause: Boolean = false): Unit
Register to receive push messages for the associated PushType.
registerForSubscriptions fun registerForSubscriptions(observer: PushSubscriptionObserver, owner: LifecycleOwner = ProcessLifecycleOwner.get(), autoPause: Boolean = false): Unit
Register to receive push subscriptions when requested or when they have been re-registered.
shutdown fun shutdown(): Unit
Un-subscribes from all push message channels and stops the push service. This should only be done on an account logout or app data deletion.
subscribeAll fun subscribeAll(): Unit
Returns all subscription for the push type if available.
subscribeForType fun subscribeForType(type: PushType): Unit
Notifies observers about the subscription information for the push type if available.
unsubscribeForType fun unsubscribeForType(type: PushType): Unit
Returns subscription information for the push type if available.