Android with reference to Local Notifications Capacitor Plugin API | Ionic Documentation
I am trying to change the push notification icon in the status bar of the emulator to the original icon, but I cannot change it from the default icon.
{
"@capacitor-community/fcm": "6.0.0",
"@capacitor/android": "^6.0.0",
"@capacitor/app": "^6.0.0",
"@capacitor/browser": "^6.0.0",
"@capacitor/camera": "^6.0.0",
"@capacitor/core": "^6.0.0",
"@capacitor/filesystem": "^6.0.0",
"@capacitor/haptics": "^6.0.0",
"@capacitor/ios": "^6.0.0",
"@capacitor/keyboard": "^6.0.0",
"@capacitor/local-notifications": "^6.0.0",
"@capacitor/push-notifications": "^6.0.1",
"@capacitor/status-bar": "^6.0.0",
"@ionic/cli": "^7.2.0",
"@ionic/core": "8.2.5",
"@ionic/vue": "8.2.5",
"vue": "3.4.31",
},
The following steps were attempted to set up the original icon.
- Install @capacitor/local-notifications.
- Store ic_launcher_round.png in android/app/src/main/res/drawable folder
- Add the following to AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_launcher_round" />
</application>
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
- Add the following to capacitor.config.ts
{
plugins: {
PushNotifications: {
presentationOptions: ["badge", "sound", "alert"]
},
LocalNotifications: { //add
smallIcon: "ic_launcher_round",
iconColor: "#fff",
},
}
}
When I send a notification, the document default icon is displayed as shown in the attached image.
Changing the meta-data tag in AndroidManifest.xml from drawable to mipm. ap did not change this.
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_launcher_round" />
One thing I am wondering is that only ic_launcher_round.png is shown in red in Android Studio.
Is this related to something else?
Please do let me know.