--- title: "Notification Broadcast Receiver" slug: "setting-up-a-notification-broadcast-receiver" updated: 2026-03-10T08:48:30Z published: 2026-03-10T08:48:30Z canonical: "docs.mapp.com/setting-up-a-notification-broadcast-receiver" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.mapp.com/llms.txt > Use this file to discover all available pages before exploring further. # Notification Broadcast Receiver ## Overview A notification broadcast receiver allows your application to react to push notification lifecycle events triggered by the Mapp Engage Android SDK v7. These events include: - When a push message is received - When a notification is opened - When a notification is dismissed - When an action button is clicked - When a silent or rich push is processed Use a broadcast receiver if your app needs to execute custom logic in response to these events (for example, analytics tracking, navigation handling, or application-specific behavior). --- ## Implementation ### 1. Create a Broadcast Receiver Class Create a class (for example, `MyPushBroadcast`) that extends `LocalPushBroadcast`. Override the callback methods to define how your app should react to different notification events. #### Java ```java public class MyPushBroadcast extends LocalPushBroadcast {        private void print(String action, MappPush push) {        Log.d("MyPushBroadcast", "Action: " + action + "; Push: " + push);        }        @Override        public void onReceived(@NonNull MappPush push) {        print("onReceived", push);        }        @Override        public void onOpened(@NonNull MappPush push) {        print("onOpened", push);        }        @Override        public void onSilent(@NonNull MappPush push) {        print("onSilent", push);        }        @Override        public void onDismissed(@NonNull MappPush push) {        print("onDismissed", push);        }        @Override        public void onButtonClick(@NonNull MappPush push) {        print("onButtonClick", push);        }        @Override        public void onRichPush(@NonNull MappPush push) {        print("onRichPush", push);        }        } ``` --- #### Kotlin ```kotlin class MyPushBroadcast : LocalPushBroadcast() {        private fun print(action: String, push: MappPush) {        val title = push.title        val content = push.content        Log.i("MyPushBroadcast", "ACTION: $action; PUSH: $push; TITLE: $title; CONTENT: $content")        }        override fun onReceived(push: MappPush) {        print("onReceived", push)        }        override fun onOpened(push: MappPush) {        print("onOpened", push)        }        override fun onSilent(push: MappPush) {        print("onSilent", push)        }        override fun onDismissed(push: MappPush) {        print("onDismissed", push)        }        override fun onButtonClick(push: MappPush) {        print("onButtonClick", push)        }        override fun onRichPush(push: MappPush) {        print("onRichPush", push)        }        } ``` --- ### 2. Register the Broadcast Receiver After creating the broadcast class, register it in your AndroidManifest.xml. ```xml        ...         ``` --- ### 3. Assign the Broadcast Receiver During SDK Initialization Assign your broadcast receiver so that the Mapp Engage SDK uses it to dispatch push events. #### Java ```java Appoxee.instance().setPushBroadcast(MyPushBroadcast.class); ``` #### Kotlin ```kotlin Appoxee.instance().setPushBroadcast(MyPushBroadcast::class.java) ``` --- ## Important Notes - The broadcast receiver is optional and only required if you need custom handling of push interaction events. - Ensure the receiver is declared in the AndroidManifest.xml. - Keep the logic inside the broadcast methods lightweight. --- ## Custom FirebaseMessagingService (Optional) If your application uses a custom FirebaseMessagingService (for example to support multiple push providers), you must delegate Mapp push messages to the SDK. The SDK registers its internal MappMessagingService automatically. Only implement a custom service if additional push handling is required. ### Example: ```kotlin override fun onMessageReceived(remoteMessage: RemoteMessage) {    if (Appoxee.instance().isPushMessageFromMapp(remoteMessage)) {        Appoxee.instance().handlePushMessage(remoteMessage)    } else {        // Handle non-Mapp push messages here    } } ``` When enabling push using a custom service, pass the Firebase token: ```kotlin FirebaseMessaging.getInstance().token.addOnCompleteListener { task ->    task.result?.let { token ->        Appoxee.instance().enablePush(true, token)    } } ```