public interface NexmoPushEventListener
Interface definition for a callback to be invoked when a new event is received or incoming call occurs.
Process Firebase push notifications:
public class ClientFirebaseMessagingServiceJava extends FirebaseMessagingService { @Override public void onMessageReceived(@NonNull RemoteMessage remoteMessage) { super.onMessageReceived(remoteMessage); // determine if the message is sent from Nexmo server if (nexmoClient.isNexmoPushNotification(remoteMessage.getData())) { nexmoClient.processNexmoPush(remoteMessage.getData(), new NexmoPushEventListener() { @Override public void onIncomingCall(NexmoCall call) { Log.d("onIncomingCall", "FirebaseMessage:onIncomingCall() with: " + call); } @Override public void onNewEvent(NexmoEvent event) { Log.d("onNewEvent", "FirebaseMessage:onNewEvent() with: " + event); } @Override public void onError(NexmoApiError apiError) { Log.d("onError", "FirebaseMessage:onError() with: " + apiError); } }); } } }
It is possible for some notifications to be ignored eg. incoming call notification can be ignored if information about incoming call was already retrieved by WebSocket.
To fully support incoming calls scenario you should also add NexmoIncomingCallListener
.
Modifier and Type | Method and Description |
---|---|
void |
onError(NexmoApiError error) |
void |
onIncomingCall(NexmoCall call) |
void |
onNewEvent(NexmoEvent event) |
void onIncomingCall(NexmoCall call)
call
- The incoming call.void onNewEvent(NexmoEvent event)
event
- The newly received event.void onError(NexmoApiError error)
error
- The received error.