What is payload

While defining push notifications in your campaign, you can pack with them additional structured data in json format - Payload. It can contain any data that you would like to send to your application.

For example you can put there image url:

{
    "image": "https://developer.proxi.cloud/assets/developer_proxi_logo.png"
}

Payload data can be obtained as a JSONObject or JSONArray:

Action action; //get action object, as described in android integration instruction 
               //from eventListener or broadcastReceiver
try {
    JSONObject jsonObject = action.getPayloadJSONObject();
    String imageUri = jsonObject.getString("image"); //get value of field "image"
} catch (JSONException e) {
    e.printStackTrace();
}

or simply as a String:

String payload = action.getPayload();
//now you have raw json String

Example

public class DemoActionPresenter extends BroadcastReceiver {

    @Override
    public void onReceive(final Context context, final Intent intent) {
        final Action action = intent.getParcelableExtra(Action.INTENT_KEY);

        switch (action.getType()) {
            case MESSAGE_IN_APP:
                InAppAction inAppAction = (InAppAction) action;
                showNotification(context,
                        inAppAction.getUuid().hashCode(),
                        inAppAction.getSubject(),
                        inAppAction.getBody(),
                        inAppAction.getInstanceUuid(),
                        action);
                break;
            case MESSAGE_URI:
                UriMessageAction uriMessageAction = (UriMessageAction) action;
                showNotification(context,
                        uriMessageAction.getUuid().hashCode(),
                        uriMessageAction.getTitle(),
                        uriMessageAction.getContent(),
                        uriMessageAction.getInstanceUuid(),
                        action);
                break;
            case MESSAGE_WEBSITE:
                VisitWebsiteAction visitWebsiteAction = (VisitWebsiteAction) action;
                showNotification(context,
                        visitWebsiteAction.getUuid().hashCode(),
                        visitWebsiteAction.getSubject(),
                        visitWebsiteAction.getBody(),
                        visitWebsiteAction.getInstanceUuid(),
                        action);
                break;
        }
    }

    public void showNotification(final Context context, final int id, final String title,
                                 final String content, final String instanceUUID, final Action action) {

        final NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);

        if (notificationManager.areNotificationsEnabled()) {
            final String imageUrlFromPayload = getDataFromPayload(action, "image");

            new Thread(new Runnable() {
                @Override
                public void run() {
                    Notification notification = createNotification(context, title, content, imageUrlFromPayload);
                    notificationManager.notify(id, notification);
                    ProxiCloudSdk.notifyConversionStatus(context, instanceUUID, Conversion.NOTIFICATION_SHOWN);
                }
            }).start();
        } else {
            ProxiCloudSdk.notifyConversionStatus(context, instanceUUID, Conversion.NOTIFICATION_DISABLED);
        }
    }   

    private String getDataFromPayload(Action action, String key) {
        try {
            JSONObject payload = action.getPayloadJSONObject();
            return payload.optString(key, null);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return null;
    }

    @WorkerThread
    private Notification createNotification(final Context context, String title,
                                            final String content, final String imageUri) {

        PendingIntent pendingIntent = PendingIntent.getActivity(
                context,
                0,
                DemoActivity.getIntent(context),
                PendingIntent.FLAG_UPDATE_CURRENT);

        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, "demo_channel")
                .setContentIntent(pendingIntent)
                .setContentTitle(title)
                .setSmallIcon(R.drawable.small_icon)
                .setContentText(content)
                .setAutoCancel(true)
                .setShowWhen(true);

        try {//Synchronous call Picasso get() can't be processed in the main thread
            Bitmap bitmap = new Picasso.Builder(context)
                    .build()
                    .load(imageUri)
                    .get();

            if (bitmap != null) {
                notificationBuilder.setLargeIcon(bitmap)
                        .setStyle(new NotificationCompat.BigPictureStyle()
                                .bigLargeIcon(null)
                                .bigPicture(bitmap)
                                .setSummaryText(content));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

        return notificationBuilder.build();
    }
}

Defining payload in panel:

Payload in Panel