Flutter Push

Learn how to handle push notifications in Flutter.

Push Notifications


To use Push Notifications out of the box using CleverTap, add the following entries to your AndroidManifest.xml

        <service android:name="com.clevertap.android.sdk.pushnotification.fcm.FcmMessageListenerService" 
                <action android:name="com.google.firebase.MESSAGING_EVENT" />



Notification trampolines in Android 12 and above.

To improve performance, Android has changed the handling of push notifications for version 12 and above. An app is no longer allowed to start an activity from within a service or broadcast receiver. For more information, refer to Android 12 Push Changes.

Creating Notification Channel

CleverTapPlugin.createNotificationChannel("fluttertest", "Flutter Test", "Flutter Test", 3, true);

Delete Notification Channel


Creating a group notification channel

CleverTapPlugin.createNotificationChannelGroup(“groupId”, “groupName”);

Delete a group notification channel


Push Notification Callback

The CleverTap SDK gives you a callback when a Push Notification is clicked along with the entire payload. For this You can register the setCleverTapPushClickedPayloadReceivedHandler callback .

CleverTapPlugin _clevertapPlugin = new CleverTapPlugin();

 void pushClickedPayloadReceived(Map<String, dynamic> map) {
    print("pushClickedPayloadReceived called");
    this.setState(() async {
      var data = jsonEncode(map);
      print("on Push Click Payload = " + data.toString());

Setting a custom Push Notification icon.

By default, our SDK uses the app's icon for both the notification icon and the notification bar icon. However, You can provide a custom app icon by adding the icon in your app's android resources and registering it with clevertap in your AndroidManifest.xml
Checkout this section for more info.

Custom Push Notification Handling

If you have your custom implementation for managing Android push notifications, you can inform CleverTap about the user’s Push Service Registration ID :

Custom FCM Implementation


Custom Baidu Implementation


Custom Huawei Implementation


Custom Xiaomi Implementation


Push Notification Templates (Android Only)

CleverTap Push Templates SDK helps you engage with your users using fancy push notification templates built specifically to work with CleverTap.
It requires no Flutter-specific integration and can be enabled via android code only. Find the complete integration steps for the CleverTap Push Templates SDK here and the associated documentation here


  1. Refer to iOS Push Notifications setup and follow the same steps till step 4 in the document and in your runner application in Xcode, please configure the push notifications in your Flutter project.

  2. Call the following from your Dart:

  1. Now go to this page on how to create a push notification Campaign on CleverTap dashboard or you can follow the remaining steps on CleverTap iOS Push Notifications page

Flutter Push Notification Callback on iOS

The CleverTap SDK gives you a callback when a Push Notification is clicked along with the entire payload. For this, You can register the CleverTapPushNotificationClicked callback.


You can raise a callback event if a notification is viewed on Flutter Application.



CleverTap Push Templates

Currently CleverTap doesn't support fancy push templates for iOS.

Deeplink or External URL (iOS)

A deeplink helps you open a particular activity in your app after a click on the notification. If left empty, the notification on click will open the launcher activity of the app. Deep links allow you to land the user on a particular part of your app. Your app's OpenURL method is called with the deep link specified here. If you want to use external URLs, you will have to whitelist the IPs or provide http/https before the URL so that the SDK can appropriately handle them. For more information, refer to Deeplinking.

With CleverTap Flutter SDK, you can implement custom handling for URLs of in-app notification CTAs, push notifications, and app Inbox messages.

Check that your class conforms to the CleverTapURLDelegate protocol by first calling setURLDelegate. Use the following protocol method shouldHandleCleverTap(_ : forChannel:) to handle URLs received from channels such as in-app notification CTAs, push notifications, and app Inbox messages:

#import <CleverTapSDK/CleverTapURLDelegate.h>

// Set the URL Delegate
[[CleverTap sharedInstance]setUrlDelegate:self];

// CleverTapURLDelegate method 
- (BOOL)shouldHandleCleverTapURL:(NSURL *)url forChannel:(CleverTapChannel)channel {
    NSLog(@"Handling URL: \(%@) for channel: \(%d)", url, channel);
    return YES;
// Set the URL Delegate

 // CleverTapURLDelegate method
public func shouldHandleCleverTap(_ url: URL?, for channel: CleverTapChannel) -> Bool {  
    print("Handling URL: \(url!) for channel: \(channel)") 
    return true 

Manually Enabling support for deeplink tracking in the application

To manually enable support for deeplink tracking in the application itself, refer to iOS Deeplink Tracking.

What’s Next