1

My code used to successfully silence incoming calls by simply using setRingerMode, but ever since Android Pie, it's just not working anymore. I had tested the built-in DND mode, and it seemed to not be working either. But if that's true, it's working now, but my code still isn't.

Is there something additional necessary for this to work now? Android Pie does keep a separate mode from DND for ring, vibrate, and silence for ringer sounds, but I haven't been able to find figure out why my code isn't working anymore.

Update: I'm using the following code:

AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
am.setRingerMode(AudioManager.RINGER_MODE_SILENT);

Update (1-23-19): My understanding is I can't change the notification channel of another app, like the texting or calling app. Does anybody know any differently?

craned
  • 2,991
  • 2
  • 34
  • 38
  • Well, we'd be able to help figure out why your code isn't working anymore if you were to post it. – Ishaan Javali Jan 02 '19 at 18:52
  • 1
    @IshaanJavali, as mentioned, all I use is `setRingerMode()`. I can post more code later, but I thought maybe there was something additional required now for it to work. – craned Jan 02 '19 at 19:10
  • @IshaanJavali, I have added additional code. – craned Jan 03 '19 at 02:30
  • I have no idea why you are using audio service for notification, but if it is notification have u tried using channel and set the setting for it? It might works that way hope it help. – DemiDust Jan 03 '19 at 03:43
  • @DemiDust, I'm using the audio service bc it needs to be silenced, and that's what Android has said to use. A notification channel is for displaying a notification, not for silencing it to my knowledge. But if you think that will work, please feel free to post some code to do so, and I will try it. – craned Jan 03 '19 at 11:52
  • from what i have known you can modify the importance for the notification from the channel `val mChannel = NotificationChannel(CHANNEL_ID, channelName, NotificationManager.IMPORTANCE_LOW)`, importance low will mute the notification i think, CMIIW tho – DemiDust Jan 03 '19 at 16:13
  • @DemiDust, do notifications include phone calls? – craned Jan 03 '19 at 18:12
  • @DemiDust, how do I get the CHANNEL_ID for the texting or calling app? – craned Jan 24 '19 at 17:12

0 Answers0