我正在使用react-native模块(React-native-pjsip)的fork,并且需要在通知中使用以下图像:
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, "")
.setContentTitle("My app Name")
.setSmallIcon(android.R.drawable.ic_launcher)
.setContentText("The app is running on foreground!")
.setContentIntent(openAppPendingIntent)
.addAction(action)
.setOngoing(true)
.setPriority(NotificationCompat.PRIORITY_MIN);
问题是:
没有可绘制的文件夹,并且我没有创建一个成功的文件夹。
ic_launcher文件是我自己的应用程序图标,通知运行良好,唯一的问题是自定义图标本身。
我编译时的错误是:
error: cannot find symbol
.setSmallIcon(android.R.drawable.ic_launcher)
^
symbol: variable ic_launcher
location: class drawable
最佳答案
解决方案是:使用“ R.drawable.ic_launcher”代替“ android.R.drawable.ic_launcher”
关于javascript - 将图像添加到node_modules包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58844226/