-
Notifications
You must be signed in to change notification settings - Fork 17
Mirror push notifications
Previously known as
Basic In-App notifications
, check public documentation.
In addition to showing a push notification, you can show the notification within the app. When the end user is using the app, the notification is displayed as a pop-up within the app and overlaps a part of the screen. Use this feature for scenarios when you want to get the full attention of the end user and ask them to do something.
- If the end user misses a push notification, they can get the notification within their app.
- Mirrored push notifications are triggered within the app even if the end user has opted out from push notifications.
Mirror push notifications are alerts shown in foreground when user opens the app. Modal supported since 1.13.0. Banner supported since 2.0.0, Huawei SDK 1.0.0.
Default displaying of mirror push notifications is available by using of our SDK and sending a mirror push notification. If you want to opt out and create your own mirror push notifications use this setting.
After you integrated Mobile Messaging SDK into your app, you just need to send a message using Push HTTP single, multiple or OMNI API providing the desired inAppStyle
notification option - either MODAL
or BANNER
. The Mobile Messaging SDK will automatically display the message with appropriate style.
When inAppStyle
notification option is set to MODAL
for API call or in Portal campaign settings, the Mirror push notification will be shown up in the following cases:
- notification is received and application is opened by tapping on the apps icon;
- notification is received when application is in foreground state;
- for interactive notifications, user opens the app by tapping on the notification (but not performing a notification action).
Modal Mirror push notification is supported for silent push notifications as well as for cases when the end user opted out from push notifications at OS level, so that mobile users can be targeted with Mirror push notification waiting them in the application and not get disturbed with notification on lock screen.
Modal Mirror push notification displays only the most recently received message with Mirror push notification enabled. In case of non-interactive messages, modal Mirror push alert will have default actions: "Cancel" and "Open".
For interactive notifications, actions defined for category will be displayed.
Button text color on Mirror push dialog can be defined in a style named InAppDialog
, such as:
<style name="InAppDialog" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="buttonBarButtonStyle">@style/DialogButtonStyle</item>
</style>
<style name="DialogButtonStyle" parent="Widget.AppCompat.Button.ButtonBar.AlertDialog">
<item name="android:textColor">@android:color/black</item>
</style>
Subscribe to NOTIFICATION_ACTION_TAPPED event and you're all set up to test pressed actions. If the sent notification didn’t have any category, Mirror push alert will be shown with default actions (localized texts):
Action | Action ID | Foreground |
---|---|---|
Cancel |
mm_cancel |
false |
Open |
mm_open |
true |
As already mentioned, for interactive notifications actions defined for category will be used.
In the event, you've subscribed to, you can check which action has been chosen and act upon it:
private val actionTappedMessageReceiver = object: BroadcastReceiver() {
override fun onReceive(context:Context, intent: Intent) {
val message = Message.createFrom(intent.extras)
val action = NotificationAction.createFrom(intent.extras)
if (action?.id == "mm_open") {
// TODO my business logic
}
}
}
override fun onResume() {
super.onResume()
// subscribe to NOTIFICATION_ACTION_TAPPED event
val localBroadcastManager = LocalBroadcastManager.getInstance(this)
localBroadcastManager.registerReceiver(actionTappedMessageReceiver, IntentFilter(InteractiveEvent.NOTIFICATION_ACTION_TAPPED.key))
}
expand to see Java code
// declare action tapped message receiver
private final BroadcastReceiver actionTappedMessageReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Message message = Message.createFrom(intent.getExtras());
NotificationAction action = NotificationAction.createFrom(intent.getExtras());
if (action != null && "mm_open".equals(action.getId())) {
// TODO my business logic
}
}
};
@Override
protected void onResume() {
super.onResume();
// subscribe to NOTIFICATION_ACTION_TAPPED event
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(this);
localBroadcastManager.registerReceiver(actionTappedMessageReceiver, new IntentFilter(InteractiveEvent.NOTIFICATION_ACTION_TAPPED.getKey()));
}
Temporary banners will simply appear at the top of your screen and then disappear after few seconds. When inAppStyle
notification option is set to BANNER
for API call or in Portal campaign settings, the Mirror push notification will be shown up in the following cases:
- notification is received when application is in foreground state.
It's possible to disable In-App messages and Mirror push notifications, for further details check this page - Disable In-App notifications.
If you have any questions or suggestions, feel free to send an email to [email protected] or create an issue.
- Library events
- Server errors
- Users and installations
- Messages and notifications management
- Inbox
Geofencing API- DEPRECATED- Android Manifest components
- Privacy settings
- In-app chat
- Infobip RTC calls and UI
- Backup rules