-
public abstract class MessagingReceiver extends BroadcastReceiver
Deprecated, please use PushService instead.
Receive UnifiedPush messages (new endpoints, unregistrations, push messages, errors) from the distributors
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.
The receiver has to be exposed in the
AndroidManifest.xmlin 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>
-
-
Constructor Summary
Constructors Constructor Description MessagingReceiver()
-
Method Summary
Modifier and Type Method Description KeyManagergetKeyManager(Context context)Define the KeyManager to use. abstract UnitonNewEndpoint(Context context, PushEndpoint endpoint, String instance)A new endpoint is to be used for sending push messages. abstract UnitonRegistrationFailed(Context context, FailedReason reason, String instance)The registration is not possible, eg. abstract UnitonUnregistered(Context context, String instance)This application is unregistered by the distributor from receiving push messages abstract UnitonMessage(Context context, PushMessage message, String instance)A new message is received. UnitonReceive(Context context, Intent intent)Handle UnifiedPush messages, should not be override -
Methods inherited from class org.unifiedpush.android.connector.MessagingReceiver
abortBroadcast, clearAbortBroadcast, getAbortBroadcast, getDebugUnregister, getResultCode, getResultData, getResultExtras, getSentFromPackage, getSentFromUid, goAsync, isInitialStickyBroadcast, isOrderedBroadcast, peekService, setDebugUnregister, setOrderedHint, setResult, setResultCode, setResultData, setResultExtras -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getKeyManager
KeyManager getKeyManager(Context context)
Define the KeyManager to use. DefaultKeyManager by default.
If you wish to change the KeyManager, you need to call UnifiedPush.register, UnifiedPush.unregister and UnifiedPush.removeDistributor with the same KeyManager.
-
onNewEndpoint
abstract Unit onNewEndpoint(Context context, PushEndpoint endpoint, String instance)
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.
-
onRegistrationFailed
abstract Unit onRegistrationFailed(Context context, FailedReason reason, String instance)
The registration is not possible, eg. no network, depending on the reason, you can try to register again directly.
-
onUnregistered
abstract Unit onUnregistered(Context context, String instance)
This application is unregistered by the distributor from receiving push messages
-
onMessage
abstract Unit onMessage(Context context, PushMessage message, String instance)
A new message is received. The message contains the decrypted content of the push message for the instance
-
-
-
-