Follow

Set Up In-App Messaging

Set Up In-App Messaging

The Kahuna SDK for Android provides support to allow you to send in-app messages to your users.

Note: SDK 2.4.0 and above provides Marketer-Driven In-App Messaging so that you can develop messages with unique content using one of several template styles provided by Kahuna. If you use Marketer-Driven In-App Messaging, no setup is required and you can skip this section; however, you must contact Customer Success to turn on this feature for your namespace. If your app already has an in-app message style that you want to keep, you can use Custom In-App Messaging, which requires the following setup.

To set up Custom In-App Messaging

  1. Implement the In-App Messenger interface in the activity responsible for showing the in-app message when one arrives. In most cases this is your Main Activity, but you can specify any activity.

     private KahunaInAppMessageListener inAppListener = new KahunaInAppMessageListener() {
    
        @Override
        public void onInAppMessageReceived(String message, Bundle deepLinkingExtras) {
            // Display your in-app message here: (Preferably with an Alert Dialog)
        }
    };
  2. Register for the In-App Listener callback, as shown below.

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
        Kahuna.getInstance().registerInAppMessageListener(inAppListener);
    }
  3. Unregister your listener after your Activity is destroyed.

    Note: In-App messages can arrive at anytime but only show if your listening Activity has not been destroyed.

    @Override
    protected void onDestroy() {
        super.onDestroy();
    
        Kahuna.getInstance().unregisterInAppMessageListener();
    }

Note: Ensure that your code handles cases where the in-app message does not include some or all of the deep linking key-value pairs you have defined. Different campaigns might send all of the key-value pairs, only some, or none. Make sure your mobile app checks for the presence of a particular key-value pair before it tries to use it.

To track Custom In-App Messages (clicks, dismisses, displayed, and not displayed events) just like marketer-driven in-app messages, please also implement the events described on Configuring Kahuna Integration To Track Custom In-App Message Events.

After you complete the steps in this topic, your activity is ready to start receiving custom in-app messages from Kahuna.

Now, follow the steps in Add Events and Attributes.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments