I have seen a lot of questions about ringer mode. Nothing seems to give me a clue on the problem I am facing. I have set ringer mode to the normal RING mode for a service that gets started in the foreground. Unfortunately that doesnt seem to change the phone's ringer mode if it was on silent or vibrate in the first place. However, if put the same piece of code behind a button on an activity then it works.
The above described case happens only in Android 4.0.4 (ICS) but not in FR 2.2. Any clue on how to get around this? Here's my code:
AudioManager audioManager = (AudioManager) ctx.getSystemService(Context.AUDIO_SERVICE);
audioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);