public class NotificationPayload
extends java.lang.Object
GcmListener.onMessageReceived()
implementation to retrieve Twilio-generated
payload fields safely.
Do not access the fields in the bundle directly - they could be modified without notice, always
use this helper to access them.Modifier and Type | Class and Description |
---|---|
static class |
NotificationPayload.Type |
Constructor and Description |
---|
NotificationPayload(android.os.Bundle data)
Create notification payload from the received bundle.
|
NotificationPayload(java.util.Map<java.lang.String,java.lang.String> remoteMessage)
Create notification payload from the received map.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAuthor() |
java.lang.String |
getBody() |
java.lang.String |
getChannelSid() |
java.lang.String |
getChannelTitle() |
java.lang.String |
getMessageSid() |
java.lang.String |
getSound() |
NotificationPayload.Type |
getType()
Get notification type.
|
public NotificationPayload(android.os.Bundle data)
data
- Android Bundle with push notification data as received from the system.
Example:
public class GCMListenerService extends GcmListenerService
{
{@literal @}Override
public void onMessageReceived(String from, Bundle data)
{
NotificationPayload payload(data);
// Do the processing here
}
}
public NotificationPayload(java.util.Map<java.lang.String,java.lang.String> remoteMessage)
remoteMessage
- Android FCM RemoteMessage with push notification data as received
from the system.
Example:
public class FCMListenerService extends FirebaseMessagingService { {@literal @}Override public void onMessageReceived(RemoteMessage remoteMessage) { { NotificationPayload payload(remoteMessage.getData()); // Do the processing here } } }
public NotificationPayload.Type getType()
NotificationPayload.Type
enum.public java.lang.String getAuthor()
public java.lang.String getBody()
public java.lang.String getChannelTitle()
public java.lang.String getChannelSid()
public java.lang.String getMessageSid()
public java.lang.String getSound()