Oracle Help Center | Oracle Responsys Mobile App Platform Cloud Service title

Passing Extra Data

Push notifications designed in Responsys can contain "extra" data that is passed from Responsys to the mobile app. This feature can be used for custom behaviors other than deep-linking or rich push, which are already handled automatically by the SDK. Marketers and Developers must agree on how to handle each key–value pair.

getStringExtra Example

The following example uses two extra key/pairs (alert, details) to build a notification based off the details of those extras.

public class NotificationBroadcastReceiver extends BroadcastReceiver {

private NotificationManager mNotificationManager;
private int SIMPLE_NOTIFICATION_ID;

public void onReceive(Context context, Intent intent) {
if (intent != null) {
for( String t :intent.getExtras().keySet()) {
try {
Log.d("class", "extra key: " + t + " value: " +
intent.getStringExtra(t));
} catch (Exception e ){
Log.d("class", "Not a string", e);
}
}
}
mNotificationManager = (NotificationManager)
context.getSystemService(Context.NOTIFICATION_SERVICE);

Intent newIntent = new Intent(context,
PushIOActivityLauncher.class);
newIntent.putExtras(intent);

for( String t :newIntent.getExtras().keySet()) {
try {
Log.d("class", "newIntent extra key: " + t + " value: " +
newIntent.getStringExtra(t));
} catch (Exception e ){
Log.d("class", "Not a string", e);
}
}

PendingIntent.getActivity(this, 0, newIntent, PendingIntent.FLAG_UPDATE_CURRENT);

NotificationCompat.Builder notify = new
NotificationCompat.Builder(context);
notify.setSmallIcon(R.drawable.ic_logo)
.setWhen(System.currentTimeMillis())
.setTicker(intent.getStringExtra("alert"))
.setContentIntent(lPendingIntent)
.setContentTitle(intent.getStringExtra("alert"))
.setContentText(intent.getStringExtra("details"))
.setAutoCancel(true);

mNotificationManager.notify(SIMPLE_NOTIFICATION_ID, notify.build());
Bundle extras = getResultExtras(true);
extras.putInt(PushIOManager.PUSH_STATUS,
PushIOManager.PUSH_HANDLED_NOTIFICATION);
setResultExtras(extras);
}
}

Setting Key-value Pairs in Responsys

The following picture shows where Marketers can enter the key-value pairs to pass when they create their push notification campaigns in Responsys.

"Key-value pairs screenshot"