CleverTap / clevertap-flutter

CleverTap Flutter SDK
Other
32 stars 44 forks source link

White stub in notification pushed from Clevertap dashboard (Android) #86

Closed snghnishant closed 2 years ago

snghnishant commented 2 years ago

Notification pushed from Clevertap dashboard (Android) shows a white stub instead of the app icon in the notification system tray. However, firebase notifications pushed from our custom backend server works fine and displays with the app icon properly.

Device info

Flutter 2.8.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision cf44000065 (10 days ago) • 2021-12-08 14:06:50 -0800
Engine • revision 40a99c5951
Tools • Dart 2.15.0
Clevertap plugin : v1.4.0

White stub in notification icon

AndroidManifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="in.stratzy">
    <!-- io.flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startInitialization(this); in its onCreate method.
         In most cases you can leave this as-is, but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here. -->
    <!-- Required to allow the app to send events and user profile information -->
    <uses-permission android:name="android.permission.INTERNET"/>
    <!-- Recommended so that CleverTap knows when to attempt a network call -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_CONTACTS"/>
    <uses-permission android:name="android.permission.WRITE_CONTACTS"/>
    <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
    <uses-permission android:name="android.permission.VIBRATE"/>
    <queries>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <data android:scheme="https" />
        </intent>
    </queries>

    <application
        android:name="com.clevertap.android.sdk.Application"
        android:label="Stratzy"
        android:allowBackup="false"
        android:icon="@mipmap/ic_launcher">
        <!--  android:allowBackup="false" This solves the Xiaomi devices backup and storage problem -->
        <!-- Notification logo fix -->
        <!-- Set custom default icon. This is used when no icon is set for incoming notification messages. -->
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/ic_stat_stratzy" />
        <!-- Set color used with incoming notification messages. This is used when no color is set for the incoming
             notification message. See README(https://goo.gl/6BKBk7) for more. -->
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_color"
            android:resource="@color/colorGreen" />
        <!-- [END fcm_default_icon] -->
        <!-- [START fcm_default_channel] -->
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_channel_id"
            android:value="@string/default_notification_channel_id" />
        <!-- [END fcm_default_channel] -->
        <meta-data
            android:name="CLEVERTAP_ACCOUNT_ID"
            android:value="xxx-xxx-xxxx"/>
        <meta-data
            android:name="CLEVERTAP_TOKEN"
            android:value="xxx-xxx"/>
        <!-- IMPORTANT: To force use Google AD ID to uniquely identify  users, use the following meta tag. GDPR mandates that if you are using this tag, there is prominent disclousure to your end customer in their application. Read more about GDPR here - https://clevertap.com/blog/in-preparation-of-gdpr-compliance/ -->
        <meta-data
            android:name="CLEVERTAP_USE_GOOGLE_AD_ID"
            android:value="1"/>
        <!--Facebook analytics-->
        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id" />

        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <!-- Displays an Android View that continues showing the launch screen
                 Drawable until Flutter paints its first frame, then this splash
                 screen fades out. A splash screen is useful to avoid any visual
                 gap between the end of Android's launch screen and the painting of
                 Flutter's first frame. -->
            <meta-data
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <intent-filter>
                <action android:name="FLUTTER_NOTIFICATION_CLICK" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <!-- Deep linking -->
<!--            <meta-data android:name="flutter_deeplinking_enabled" android:value="true" />-->
<!--            <intent-filter android:autoVerify="true">-->
<!--                <action android:name="android.intent.action.VIEW" />-->
<!--                <category android:name="android.intent.category.DEFAULT" />-->
<!--                <category android:name="android.intent.category.BROWSABLE" />-->
<!--                <data android:scheme="http" android:host="stratzy.in" />-->
<!--                <data android:scheme="https" />-->
<!--            </intent-filter>-->
            <!-- Deep Links -->
            <intent-filter>
              <action android:name="android.intent.action.VIEW" />
              <category android:name="android.intent.category.DEFAULT" />
              <category android:name="android.intent.category.BROWSABLE" />
              <!-- Accepts URIs that begin with YOUR_SCHEME://YOUR_HOST -->
              <data
                android:scheme="https"
                android:host="stratzy.page.link" />
            </intent-filter>
        </activity>
        <!-- Clevertap, read -https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTV4CHANGES.md -->
        <!-- to use Firebase messaging-->
        <service android:name="com.clevertap.android.sdk.pushnotification.fcm.FcmMessageListenerService"
            android:exported="false">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>
        <!-- to enable push notification-->
        <service
            android:name="com.clevertap.android.sdk.pushnotification.CTNotificationIntentService"
            android:exported="false">
            <intent-filter>
                <action android:name="com.clevertap.PUSH_EVENT" />
            </intent-filter>
        </service>
        <!--To enable Push Amplification-->
        <meta-data
            android:name="CLEVERTAP_BACKGROUND_SYNC"
            android:value="1"/>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>
darshanclevertap commented 2 years ago

@snghnishant Please follow the steps here for setting the small notification icon

snghnishant commented 2 years ago

@darshanclevertap Seems like the issue is device-specific as most of the devices for our app are getting the notification icon. You may close the issue. Thanks for the help.