I have an app of school hours and put the option to mute the device during the time stipulated by the user (beginning and end). However there is only the option to enable and disable this feature. How can I do this then?
Asked
Active
Viewed 1,074 times
1 Answers
2
Use AlarmManager to schedule times where you want mute or turn sound on in your phone, start here
and AudioManager to turn it on or off:
AudioManager am;
am= (AudioManager) getBaseContext().getSystemService(Context.AUDIO_SERVICE);
//For Normal mode
am.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
//For Silent mode
am.setRingerMode(AudioManager.RINGER_MODE_SILENT);
//For Vibrate mode
am.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);

Smile2Life
- 1,921
- 3
- 16
- 30