Flutter In-App
Learn how to handle In-App notifications in Flutter.
In-App Notifications
The CleverTap SDK allows you to show In-App notifications to your users and send In-App messages with images, GIFs, video, and audio. You can design In-App notifications right from the dashboard without writing a single line of code. No code is required for this feature. You can also do A/B testing on your In-App notifications.
Header and Footer In-App Notification Template for Android
To use CleverTap's Header and Footer In-App Notification Templates, update the
MainActivity
class to inherit theFlutterFragmentActivity
class instead ofFlutterActivity
.public class MainActivity extends FlutterFragmentActivity { //FlutterFragmentActivity supports Header & Footer InApp Notification Templates }
In-App Notification Button onClick
Callbacks
onClick
CallbacksTo handle the In-App Button onClick
add the following code snippet:
_clevertapPlugin.setCleverTapInAppNotificationButtonClickedHandler(inAppNotificationButtonClicked);
void inAppNotificationButtonClicked(Map<String, dynamic> map) {
this.setState(() {
print("inAppNotificationButtonClicked called = ${map.toString()}");
});
}
In-App Notification onDismissed
callback
onDismissed
callbackCalled after the In-App notification is dismissed through user interaction or auto-close.
_clevertapPlugin.setCleverTapInAppNotificationDismissedHandler(inAppNotificationDismissed)
void inAppNotificationDismissed(Map<String, dynamic> map) {
this.setState(() {
print("inAppNotificationDismissed called");
});
}
In-App Notification onShow
callback
onShow
callbackCalled when an In-App notification is displayed to the user.
_clevertapPlugin.setCleverTapInAppNotificationShowHandler(inAppNotificationShow);
void inAppNotificationShow(Map<String, dynamic> map) {
this.setState(() {
print("inAppNotificationShow called = ${map.toString()}");
});
}
Control In-App Notifications
You can suspend, discard, or resume In-App notifications.
Note
The CleverTap SDK automatically resumes displaying the In-App notification after every new session.
Suspend
This method suspends and saves In-App notifications until resumeInAppNotifications
method is called for the current session.
CleverTapPlugin.suspendInAppNotifications();
Discard
This method suspends the display of In-App Notifications and discards any new In-App notifications.
In-app notifications are discarded until the resumeInAppNotifications
method is called for the current session.
CleverTapPlugin.discardInAppNotifications();
Resume
The resumeInAppNotifications
method resumes displaying In-App notifications. If you call this method after the discardInAppNotifications()
method, it resumes the In-App notifications for events raised after the call is performed.
However, if you call the resumeInAppNotifications
method after the suspendInAppNotifications()
method, then it displays all queued In-App notifications and also resumes In-App notifications for events raised after the call is performed.
CleverTapPlugin.resumeInAppNotifications();
Web Pop-Ups
CleverTap Flutter SDK v2.0.0 onwards supports Web Pop-Ups
Updated 26 days ago