离线推送时,通知渠道channel的重要性importance值会从“高”变成“一般”,这是什么原因
S沈***23
发布于 3 年前
5459来自湖北省消息推送 U-Push
移动统计 U-App
功能使用
消息的提醒级别importance设置的是NORMAL,我指的importance是通知channel的importance值,通过下面一段代码跳转到通知页,调整通知渠道channel的重要性为“高”,值为4。
Intent intent = new Intent();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
intent.putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName());
} else {
intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
intent.putExtra("app_package", context.getPackageName());
intent.putExtra("app_uid", context.getApplicationInfo().uid);
}
if (currentActivity != null) {
currentActivity.startActivity(intent);
NotificationManager notificationManager = (NotificationManager) currentActivity.getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
notificationManager.areNotificationsEnabled();
}
}但是在下一次接收到离线通知后,通知渠道channel的重要性自动降为了“一般”,值为3。
通知内容的importance值为“NORMAL”,category为“WORK”。
这种通知渠道channel的重要性自动降级是什么原因呢?
另外,我集成的是友盟推送,使用华为推送版本为
api 'com.huawei.hms:push:6.9.0.300'(1)_1687662850532.png)