I am making application where phone mode will changes from silent mode to ringer mode if the user sends an sms with some specific keyword. The application mainly works when user lost his cell somewhere in house and its on silent mode. My main question is how can i change the phone mode through audio manager ??
set SILENT mode to Normal mode using AudioManager
AudioManager am = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
switch (am.getRingerMode()) {
case AudioManager.RINGER_MODE_SILENT:
Log.i("MyApp","Silent mode");
am.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
break;
}
try this:
AudioManager audioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
audioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With