当我下拉状态栏时,我可以看到我的应用程序的通知,但没有任何图标显示。 图标是指白色的小图标,如wifi图标。我已经使用Android Asset Studio来生成我正在使用的图标。这是代码:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
String chanel_id = "3000";
CharSequence name = "Channel";
String description = "Disc";
int importance = NotificationManager.IMPORTANCE_HIGH;
NotificationChannel mChannel = new NotificationChannel(chanel_id, name, importance);
mChannel.setDescription(description);
mChannel.enableLights(true);
mChannel.setLightColor(Color.BLUE);
notificationManager.createNotificationChannel(mChannel);
Bitmap bitmap = BitmapFactory.decodeResource(gameActivity.getResources(), R.drawable.ic_kb);
mBuilder = new Notification.Builder(gameActivity, chanel_id)
.setSmallIcon(R.drawable.ic_kb)
.setLargeIcon(bitmap)
.setContentTitle(title)
.setContentText(text);
}
答案 0 :(得分:0)
您打过电话notificationManager.notify(chanel_id, mBuilder.build());
吗?