我使用Cordova和Phonegap创建了一个应用程序,我使用OneSignal发送推送通知,但当我向用户发送通知时,它会显示一个小铃铛图标和一个大铃铛图标。我已经更改了大铃铛图标,因为它使用链接,而小铃铛图标使用资源,所以我无法更改,请帮助我。
我使用Cordova和Phonegap创建了一个应用程序,我使用OneSignal发送推送通知,但当我向用户发送通知时,它会显示一个小铃铛图标和一个大铃铛图标。我已经更改了大铃铛图标,因为它使用链接,而小铃铛图标使用资源,所以我无法更改,请帮助我。
ic_stat_onesignal_default
。但是文件的位置取决于您使用的Cordova分支。<project-root>/platforms/android/res/drawable-[SIZE_NAMES]/
PhoneGap Build(PGB):
<project-root>/locales/android/drawable-[SIZE_NAMES]/
用hdpi
、xhdpi
、xxhdpi
、xxxhdpi
替换[SIZE_NAMES]
,为每个名称创建一个文件夹。总共将创建四个文件夹。https://documentation.onesignal.com/docs/customize-notification-icons
在drawable文件夹中,正常向量资源或png文件不起作用,即使是mipmap也一样。您需要创建具有不同大小配置的自定义drawable。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)
对于 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)
这里有一个链接,请先尝试搜索,如果没有找到有用的信息,再考虑发布问题,因为已经有一些问题得到了回答。
NotificationCompat.Builder notificationCompat = new NotificationCompat.Builder(this) .setWhen(System.currentTimeMillis()) .setAutoCancel(true) .setSmallIcon(R.mipmap.logo).setLargeIcon(R.mipmap.logo1)
NotificationCompat.Builder notificationCompat = new NotificationCompat.Builder(this) .setWhen(System.currentTimeMillis()) .setAutoCancel(true) .setSmallIcon(R.mipmap.logo).setLargeIcon(R.mipmap.logo1)