MessagingReceiver

Deprecated, please use PushService instead.

Receive UnifiedPush messages (new endpoints, unregistrations, push messages, errors) from the distributors

Deprecation note

The library already embed a receiver implementing this receiver and forward the events to a service. This allow us to maintain the declaration of the exposed service, which can make maintenance easier if any change is required in the future.

It is still possible to use this receiver directly: if a receiver with this intent filter is declared in your manifest, the one declared in the library won't run.

Expose this receiver

The receiver has to be exposed in the AndroidManifest.xml in order to receive the UnifiedPush messages.

<receiver android:exported="true"  android:enabled="true"  android:name=".CustomReceiver">
<intent-filter>
<action android:name="org.unifiedpush.android.connector.MESSAGE"/>
<action android:name="org.unifiedpush.android.connector.UNREGISTERED"/>
<action android:name="org.unifiedpush.android.connector.NEW_ENDPOINT"/>
<action android:name="org.unifiedpush.android.connector.REGISTRATION_FAILED"/>
</intent-filter>
</receiver>

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
open fun getKeyManager(context: Context): KeyManager

Define the KeyManager to use. DefaultKeyManager by default.

Link copied to clipboard
abstract fun onMessage(context: Context, message: PushMessage, instance: String)

A new message is received. The message contains the decrypted content of the push message for the instance

Link copied to clipboard
abstract fun onNewEndpoint(context: Context, endpoint: PushEndpoint, instance: String)

A new endpoint is to be used for sending push messages. The new endpoint should be send to the application server, and the app should sync for missing notifications.

Link copied to clipboard
open override fun onReceive(context: Context, intent: Intent)

Handle UnifiedPush messages, should not be override

Link copied to clipboard
abstract fun onRegistrationFailed(context: Context, reason: FailedReason, instance: String)

The registration is not possible, eg. no network, depending on the reason, you can try to register again directly.

Link copied to clipboard
abstract fun onUnregistered(context: Context, instance: String)

This application is unregistered by the distributor from receiving push messages