sha*_*anu 4 android notification-channel
我升级target build version到27需要实施notification channel.我正在启动一个前景service,它会在启动时显示通知.通过通知渠道,它按预期工作,但它总是如此make sound.更改通知priority没有任何效果.
if(Build.VERSION.SDK_INT >= 26) {
NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID,
CHANNEL_NAME, NotificationManager.IMPORTANCE_LOW);
mNotificationManager.createNotificationChannel(notificationChannel);
notification = new Notification.Builder(this,CHANNEL_ID)
.setContentTitle("My App")
.setContentText(status)
.setSmallIcon(R.drawable.ic_stat_notify)
.setContentIntent(pendingIntent)
.build();
}
Run Code Online (Sandbox Code Playgroud)
我已经检查了IMPORTANCE_MIN,IMPORTANCE_DEFAULT而且IMPORTANCE_LOW都在发声
| 归档时间: |
|
| 查看次数: |
1117 次 |
| 最近记录: |