Java 在android中发出静默通知
我已经阅读了通知文档和audiomanager。我遇到了adjustStreamVolume方法和STREAM_通知标志。我根本不明白的是,如果我想悄悄地通知用户,我应该如何准确地应用这两种方法?假设我收到以下通知:Java 在android中发出静默通知,java,android,Java,Android,我已经阅读了通知文档和audiomanager。我遇到了adjustStreamVolume方法和STREAM_通知标志。我根本不明白的是,如果我想悄悄地通知用户,我应该如何准确地应用这两种方法?假设我收到以下通知: notification = new NotificationCompat.Builder(getApplicationContext()) .setContentTitle(notification_title) .setContentText
notification = new NotificationCompat.Builder(getApplicationContext())
.setContentTitle(notification_title)
.setContentText(notification_text)
.setTicker("Notification!")
.setWhen(System.currentTimeMillis())
.setDefaults(Notification.DEFAULT_SOUND).setAutoCancel(true)
.setSmallIcon(R.drawable.ic_stat_name).build();
//and show with notification manager
adjustStreamVolume和STREAM\u通知在所有这些中的具体位置是什么?如果需要静音,请不要指定默认的\u声音。AudioManager音量设置只有在您想全局更改时才有用。@zapl和我确实可以。。。我希望我的所有通知都是静默的…对于你的应用,对于每个应用,都是全局的,而不是你的。这是您在设备的系统设置中找到的音量滑块。