How to change vibrate mode to ringer prgrammatically through audio manager

后端 未结 4 1018
一生所求
一生所求 2021-01-05 06:27

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

4条回答
  •  甜味超标
    2021-01-05 07:09

    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;   
    }  
    

提交回复
热议问题