Parse Notification Data


Any payload data that you send with your push notifications is made available to your app via the Intent extras of your PushReceiver class.


Please select your Android project type for the appropriate instructions:

Java
Kotlin

If you were to send a push notification with the following payload:

{"id": 1, "success": true, "message": "Hello World"}

Then you'd be able to retrieve each value from within your PushReceiver.java PushReceiver.kt file like so:

int id = intent.getIntExtra("id", 0);
String message = intent.getStringExtra("message");
boolean success = intent.getBooleanExtra("success", false);
val id = intent.getIntExtra("id", 0)
val message = intent.getStringExtra("message")
val success = intent.getBooleanExtra("success", false)

Note: Unlike GCM / FCM, we do not stringify your payload data, except if you supply JSON objects or arrays. This means that if you send {"id": 3}, you'd retrieve that value in the receiver using intent.getIntExtra("id", 0).