1. Are you ready for the Galaxy S20? Here is everything we know so far!

unable to set ringer mode correctly

Discussion in 'Android Development' started by pablob68, Nov 12, 2014.

  1. pablob68

    pablob68 Lurker
    Thread Starter

    Hi,
    in my app there is a main activity and a broadcast receiver class (on a separate file) on phone_state change. The broadcast receiver is registered in the manifest file and it work fine. I put the phone in silence mode. When the application is in foreground and the phone ring, in a broadcast receiver I set ringermode to normal. The first time the phone ring (silent mode), I see disappear the silent mode symbol correctly but the audio is not available. The next time everything works fine. Can anyone help me?

    many thanks!
    My broadcast receiver:
    public class Myinterceptor extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
    AudioManager mode;
    mode = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
    mode.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
    }
    }
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...

Share This Page

Loading...