Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AudioManager returns wrong RingerMode #67

Open
JitainSharma opened this issue Nov 24, 2020 · 0 comments
Open

AudioManager returns wrong RingerMode #67

JitainSharma opened this issue Nov 24, 2020 · 0 comments

Comments

@JitainSharma
Copy link

Android OS : 6.0
Device : Moto-G 2nd Gen

While using the AudioManager API to get the Phone ringer mode, the value return only for the mute/sleep is wrong, it returns the RINGER_MODE_VIBRATE instead of RINGER_MODE_SILENT on Android 6, where as the values returned correctly on Android 9 and 10.

Code is:
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;}

Ringer mode are set through phone sound/mute/vibrate profiles.
How to get correct value for silent mode?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant