2014-09-27 58 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