开发者

How to implement Phonestatelistener in an activity

I have certain data which i got, when user fill a form in an activity. There is an option Mode where user can select RING or VIBRATE.

So my question is how could i actually implement it in my activity, I see various examples on Telephony manager and phonestatelistener

http://m开发者_StackOverflow社区arakana.com/forums/android/examples/62.html.

http://www.tutorialforandroid.com/2009/01/get-phone-state-when-someone-is-calling_22.html

but its hard to implement it in my application,i have data in text form only and dont know how to use this data to switch it from one mode to another. Please tell me in terms of coding example.


phone state listener doesnt determine the ring or vibrate mode - it is for the call status (idle, ring, offhook)

to get the ring/vibrate/silent stau use Audiomanager

AudioManager am = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
am.getRingerMode();// returns AudioManager.RINGER_MODE_VIBRATE or AudioManager.RINGER_MODE_SILENT or AudioManager.RINGER_MODE_NORMAL
// to set ringer mode
am.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜