Open vishal-revdiwala opened 1 year ago
+1 noticing the same issue
Same here.
any Update on this?
I face the same issue with few devices on Android 11 + versions. I only see a box instead of the notification icon. Any update on this? Does any one have any workaround or a fix?
Workaround:
To create a notification icon set from Android Studio with a transparent background, follow these steps:
Open Android Studio and go to the "res" folder in your project's directory. Right-click on "res" and select "New" > "Image Asset." In the "Asset Type" dropdown, choose "Image." Click on "Path" and browse to the location of your desired icon, ensuring that it has a transparent background. Next, add the following meta tags to your AndroidManifest.xml file:
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_notification" />
<meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/notification_ic_color" />
Make sure that you've defined the icon background color in your colors.xml file as follows:
<color name="notification_ic_color">#D54E29</color>
By following these steps, you'll create a notification icon set with a transparent background in Android Studio. The meta tags in the AndroidManifest.xml file will reference the created icon and set the default notification color for your Firebase notifications.
Hi @vishal-revdiwala, Thanks for your response.
To have the notification icon showing correctly the png should be an icon which is transparent + white color and put it in as drawable/notification_icon.png? - This I am asking because after following your steps, I get the image as a white png. And I have iconColor included as part of PushOptions https://github.com/havesource/cordova-plugin-push/blob/master/docs/API.md#:~:text=include%20the%20extension.-,android.iconColor,-string Do I have to remove it and just add the two tags that you've mentioned in the AndroidManifest.xml? And an another doubt should I select the Icon Type as Notification Icons under ye "Image Asset."?
Hi @NityaSantosh26, just give it a try as I mentioned in the earlier comment. I also tried what you said, but it didn't work for me. After a couple of attempts, this method worked for me.
Is the icon type set as "Notification Icons" under the "Image Asset"? Yes.
Hey @vishal-revdiwala, I have tried the way you've suggested but I don't get the icon and icon color and in the debug logs I see D stored icon=null D stored iconColor=null D stored sound=true D stored vibrate=true D No icon color settings found D No icon resource found from settings, using application icon D create actions: with in-line
I've added the meta-data tags you've suggested but under application in AndroidManifest.xml but I don't see any difference. Is any code change required for this?
This works for me: I have a PNG with alpha channel. On cordova folder "config.xml" I have:
<resource-file src="alpha-logo-push-icon.png" target="/app/src/main/res/drawable/push_icon.png" />
Then on the plugin (javascript side) set to the name without file extension:
let push = PushNotification.init({
android: { ... icon: 'push_icon' },
Bug Report
Push notification icon missing (showing white box instead of app icon) in notification tray in Android 12 (SDK 32)
Expected Behaviour
Should show app icon instead of white box
Actual Behaviour
notification icon missing and shows white box
Reproduce Scenario (including but not limited to)
Keep app in background and trigger one push notification to device.
Steps to Reproduce
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
Android 12
(Android) Device Vendor (e.g. Samsung, HTC, Sony...)
Samsung, Redmi
cordova info
PrintoutCordova Packages:
Project Installed Platforms:
Project Installed Plugins:
Environment:
android Environment:
ERROR: Command failed with ENOENT: avdmanager list target spawn avdmanager ENOENT
ios Environment:
Xcode 14.2 Build version 14C18
Sample Push Data Payload
Sample Code that illustrates the problem
Logs taken while reproducing problem