I created an app using Cordova and Phonegap I use OneSignal for sending Push Notification but when I send the Notification to the user it shows a small bell icon and a Large Bell icon . I already change the large one because it uses link and small one use resource so I am not able so please help me.
Create a transparent image and name it as ic_stat_onesignal_default, and call it where it requires. It will work.
@Yokesh Is correct that the icon must be named ic_stat_onesignal_default
. The location of the file however depends on the fork of Cordova you are using.
For Cordova CLI or Ionic the path is:
<project-root>/platforms/android/res/drawable-[SIZE_NAMES]/
PhoneGap Build (PGB):
<project-root>/locales/android/drawable-[SIZE_NAMES]/
Replace [SIZE_NAMES]
with hdpi
, xhdpi
, xxhdpi
, xxxhdpi
creating one for each name. Four folders will be created in total.
See OneSignal's Customize Notification Icons guide for more details.
This link ultimately helped me: https://documentation.onesignal.com/docs/customize-notification-icons
You need to add ic_stat_onesignal_default.png in the appropriate size to each of the resource folders where icons are stored. For cordova this was:
platforms/android/res/drawable-hdpi
platforms/android/res/drawable-ldpi
platforms/android/res/drawable-mdpi
platforms/android/res/drawable-xhdpi
Here is official documentation about notification icons:
https://documentation.onesignal.com/docs/customize-notification-icons
The normal vector asset or png file in drawable is not working. Even mipmap also. You need to create custom drawable with different size configurations.
Use these directories for Native Android :
res/drawable-mdpi/ (24x24)
res/drawable-hdpi/ (36x36)
res/drawable-xhdpi/ (48x48)
res/drawable-xxhdpi/ (72x72)
res/drawable-xxxhdpi/ (96x96)
res/drawable-xxxhdpi/ (256x256) (Large Icon)
And for Cordova :
<project-root>/platforms/android/app/src/main/res/drawable-mdpi/ (24x24)
<project-root>/platforms/android/app/src/main/res/drawable-hdpi/ (36x36)
<project-root>/platforms/android/app/src/main/res/drawable-xhdpi/ (48x48)
<project-root>/platforms/android/app/src/main/res/drawable-xxhdpi/ (72x72)
<project-root>/platforms/android/app/src/main/res/drawable-xxxhdpi/ (96x96)
<project-root>/platforms/android/app/src/main/res/drawable-xxxhdpi/ (256x256) (Large Icon)
Note: use the same name file in each dir.
Here consider this link. Please try to search first if you dont find any useful info then consider posting a question there are already questions answered.
NotificationCompat.Builder notificationCompat = new NotificationCompat.Builder(this) .setWhen(System.currentTimeMillis()) .setAutoCancel(true) .setSmallIcon(R.mipmap.logo). setLargeIcon(R.mipmap.logo1)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.