1

I am creating a "do not disturb" app. So the normal thing to do is to set the phone on silent, when activated and then when a call gets through that suppose to ring, I simply change the ringer state to "normal".

The problem is that the "note 2" is indeed raising the volume but you cant hear the ringtone and in the "htc one s", when the ringer state is changed the ringtone is sounded.

How can it be? I tried to use

audio_mngr.setStreamVolume(AudioManager.STREAM_RING, 0, 0); 

and played with it but no matter what I try its still the same.

Does anyone have another idea about how to do It in another way? Thanks!

Dhasneem
  • 4,037
  • 4
  • 33
  • 47
roiberg
  • 13,629
  • 12
  • 60
  • 91
  • Sounds like bugs in these particular Android implementations. You could try saving the old volume (i.e. `getStreamVolume`) before setting the ringer mode to silent, and then restore it after you've changed the mode back to normal. – Michael Dec 22 '12 at 17:13
  • That wont help... if the phone "starts" in a silent mode than no metter what I am doing it stays silent. you can see on the top notification bar that the ringer state is not silent and the device is even vibrating but no ringtone is heard. Something I witnessed is that sometimes it actually works but most of the times its not. what could make a thing like that work only about 10% of the time and on other device 100% of the times. I tried putting it on max volume and it didn't help. its like the ringtone is not really playing if it starts on silent mode. – roiberg Dec 22 '12 at 17:18

2 Answers2

1

If AudioManager.STREAM_RING is not used perhaps these phones incorrectly use one of the below. Perhaps checking setting volumes on these and testing the ringing volume would confirm:

AudioManager.STREAM_MUSIC
AudioManager.STREAM_ALARM
AudioManager.STREAM_NOTIFICATION
AudioManager.STREAM_SYSTEM
AudioManager.STREAM_VOICECALL
John Ashmore
  • 1,015
  • 1
  • 10
  • 25
-1

Use the getRingerMode() method in AudioManager.

AudioManager am = (AudioManager)getSystemService(Context.AUDIO_SERVICE);

switch (am.getRingerMode()) {
    case AudioManager.RINGER_MODE_SILENT:
        Log.i("MyApp","Silent mode");
        break;
    case AudioManager.RINGER_MODE_VIBRATE:
        Log.i("MyApp","Vibrate mode");
        break;
    case AudioManager.RINGER_MODE_NORMAL:
        Log.i("MyApp","Normal mode");
        break;
}