I have BroadcastReceiver to listen PHONE_STATE when it receives the
incoming call it does not ring.
I see logcat shows it set the correct ringer stream volume level but still
it does not ring.
I am testing this on Nexus 4 running xylon custom ROM.
Any help?
Below is the code:
public class callListnerClass extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent)
{
Bundle bundle = intent.getExtras();
if (bundle != null)
{
String state = bundle.getString(TelephonyManager.EXTRA_STATE);
if (state.equalsIgnoreCase(TelephonyManager.EXTRA_STATE_RINGING))
{
AudioManager am = (AudioManager)
context.getSystemService(Context.AUDIO_SERVICE);
int maxVol = am.getStreamMaxVolume(AudioManager.STREAM_RING);
am.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
am.setStreamVolume(AudioManager.STREAM_RING, maxVol, 0);
int actualVol = am.getStreamVolume(AudioManager.STREAM_RING);
Log.v(MY_TAG, "Turning Ringer to max(" + maxVol + ") actual(" + actualVol +
") for incoming call");
}
}
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en