Interface CampaignHandler

Callback implemented by the app to handle potential custom data campaigns served in response to Marketing Cloud Personalization actions generated by user interactions.

For additional information, see Mobile Data Campaigns. For lifecycle details, see Context.setCampaignHandler(com.evergage.android.CampaignHandler, java.lang.String).

  • For an activity, it’s recommended to set up handlers in onStart(), as shown in this example.
  • Validate the expected campaign data or JSON before processing, since campaigns are dynamic and can be changed at any time via the Personalization UI.
  • The same campaign or content could be served again, so when applicable, use Campaign.equals(java.lang.Object) to determine if the same content is already active or visible. For example, there's no need to re-render the same message or UI to the user if it's already visible. This is especially true when testing a specific experience. For more information on testing, see Testing.

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 CampaignHandler

Parameters

ParameterDescription
campaignThe incoming campaign to be handled.