2014-09-27 59 views
0

我想要管理所有系统通知的音量。设置通知量而不设置铃声音量

如果我使用这个,通话音量也会改变。

audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); 
    audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, 0, 0); 

如何更改通知量?

感谢

回答

0

您可以更改使用通知类的通知声音。即

NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); 

NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context) 
      .setSmallIcon(R.drawable.ic_launcher) 
      .setContentTitle(context.getResources().getString(R.string.app_name)) 
      .setStyle(new NotificationCompat.BigTextStyle().bigText(message)) 
      .setContentIntent(contentIntent).setContentText(message); 

Notification notification = mBuilder.build(); 
notification.sound = Uri.parse("android.resource://" + context.getPackageName() + "/raw/generic"); 
mNotificationManager.notify(notificationId, notification); 
+0

但我需要管理所有通知的音量 – Caipivara 2014-09-27 21:00:14