Today i am going to write about changing the ringer mode of the Android phone programmitically.
Quite Simple: :-)
Step1):Make an object of Audio Manger class
AudioManager am;
am = (AudioManager)
context.getSystemService(Context.AUDIO_SERVICE);
Step2)Now after you have created the object of audio manager class you can at any time change the Ringer mode as follows:
For Silent Mode:
am.setRingerMode(0);
For Vibrate mode:
am.setRingerMode(1);
For Normal mode:
am.setRingerMode(2);
Quite Simple: :-)
Step1):Make an object of Audio Manger class
AudioManager am;
am = (AudioManager)
context.getSystemService(Context.AUDIO_SERVICE);
Step2)Now after you have created the object of audio manager class you can at any time change the Ringer mode as follows:
For Silent Mode:
am.setRingerMode(0);
For Vibrate mode:
am.setRingerMode(1);
For Normal mode:
am.setRingerMode(2);
No comments:
Post a Comment