android - Android 通知 setLargeIcon() 不起作用
问题描述
我正在使用 firebase 云消息推送通知,除了我的通知无法显示大图标外,一切都很好,我正在使用 144x144 像素和 1080x1080 的 @drawable/xxxx.PNG 图像,两者都经过测试,但仍然无法正常工作
这是我的代码
String CHANNEL_ID = "my_channel_01";
CharSequence name = "my_channel";
String Description = "This is my channel";
int importance = NotificationManager.IMPORTANCE_HIGH;
NotificationChannel mChannel = new NotificationChannel(CHANNEL_ID, name, importance);
mChannel.setDescription(Description);
mChannel.enableLights(true);
mChannel.setLightColor(Color.RED);
mChannel.enableVibration(true);
mChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400});
mChannel.setShowBadge(false);
notificationManager.createNotificationChannel(mChannel);
Bitmap largeIcon = BitmapFactory.decodeResource(getResources(), R.drawable.siublarge);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID)
.setSmallIcon(R.mipmap.ic_launcher)
.setLargeIcon(largeIcon)
.setStyle(new NotificationCompat.BigTextStyle().bigText(message) )
.setContentText(message);
解决方案
推荐阅读
- php - 如何使用 MYSQL 更新现有图像
- truevault - 如何使用 TrueVault API 获取用户
- javascript - JavaScript 箭头函数赋值
- node.js - 如何从命令行将参数传递给节点脚本?
- ember.js - 如何弃用插件中的功能?
- python - 在 HEROKU 但不是 LOCALHOST 上的“无法使用提供的凭据登录”
- c - 如何在 Linux 内核模块中实现 poll 功能?
- javascript - Vue 组件上的条件根标记
- php - 来自数据库的 PHP sql SELECT 正在工作,但即使显示成功消息,sql INSERT INTO 数据库也无法正常工作
- javascript - 如何在测验中检查答案?