我们有一个 Cordova 应用程序,其中每个 drawable-xy 文件夹中都包含一个文件“icon.png”。我们使用 OneSignal 提供推送通知。通知正在按预期工作。除了那个小图标。我的手机顶部栏上只有一个空白图标,其中显示应用程序符号。我尝试使用以下代码片段:
{
...
"small_icon" : "@android:drawable/icon.png"
....
}
我还尝试了很多很多其他变体,没有“android”,没有“drawable”,没有斜杠,有.png和没有.png。等等等等
我在文档中找到了这个:(https://documentation.onesignal.com/reference#create-notification https://documentation.onesignal.com/reference#create-notification)
small_icon: stringOptional
Specific Android icon to use. If blank the app icon is used. Must be the drawable resource name.
Android 讲述可绘制资源:(https://developer.android.com/guide/topics/resources/drawable-resource.html https://developer.android.com/guide/topics/resources/drawable-resource.html)
将图像保存在 res/drawable/myimage.png 中,此布局 XML 将图像应用到视图:
<ImageView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/myimage" />
应该是@drawable/icon
那么对我来说。 (不起作用)
将大图标更改为 url 对我有用,带有可绘制的大图标也不起作用。
该属性的正确用法是什么small_icon
?