Receive push notifications
You receive FCM Push notifications on FirebaseMessagingService#onMessageReceived
.
To handle RemoteMessage
, use the FRAClient.handleMessage()
method:
public void onMessageReceived(final RemoteMessage message) {
PushNotification notification = fraClient.handleMessage(message);
}
The method returns a PushNotification
object that contains the accept
and deny
methods
for handling the authentication request:
pushNotification.accept(new FRAListener<Void>() {
@Override
public void onSuccess(Void result) {
// called when accepting the push authentication request was successful.
}
@Override
public void onFailure(final PushAuthenticationException e) {
// called when denying the push authentication request, or it has failed.
}
});