. . .

Code to make android phone silent

Published: April 23, 2012

On This Page

    You can use the setRingerMode() method of AudioManager class. 

    AudioManager audiomanage = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
    audiomanage.setRingerMode(AudioManager.RINGER_MODE_SILENT);

     The value that you pass to the method should be one of RINGER_MODE_NORMAL, RINGER_MODE_SILENT, or RINGER_MODE_VIBRATE

    Also note that you have to add following permission to the manifest file

    android.permission.MODIFY_AUDIO_SETTINGS

     

     

    Don't forget to share this post

      Let's Build Digital Excellence Together


      • Cost Efficient Solutions.
      • Minimal Timelines.
      • Effective Communication.
      • High Quality Standards.
      • Lifetime Support.
      • Transparent Execution.
      • 24/7 Availability.
      • Scalable Teams.

      Join Our 200+ Happy Clients Across Globe


      Free Consultation.

        Do you need tech help of your startup/business? Experts from our team will get in touch with you.

        Please do not post jobs/internships inquiries here.