Callback implemented by the app to handle potential custom "Data" campaigns served in response to Marketing Cloud Personalization actions generated by the user interacting with the app.
For additional information, see Mobile Data Campaigns. For lifecycle details, see
- For an activity, it is recommended to set up handlers in
onStart(), as shown in the following example.
- Validate the expected campaign data/JSON before processing, since campaigns are dynamic and designed in the Personalization UI.
- The same campaign/content could be re-served, so when applicable, use
Campaign.equals(java.lang.Object)to determine if the same content is already active/visible. For example, there's no need to re-render the same message/UI to the user if it's already visible. This is especially true when testing a specific experience, see Testing Guide.
The following is example code that expects the featured product's name and updates a
TextView on the screen.
For more information and example code, see
|The incoming campaign to be handled.|