Possible Duplicate:
Android 2.1+ Pause for incoming/outgoing call, resum开发者_JS百科e when done
I have created a mediaplayer in android and everything works fine except that the player keeps on playing when i receive a call. To handle a call i think we should use broadcast receiver and listen to phone state. But being a beginner i couldnt figure out how to implement it?.Please help
thanks
You'll want to set up PhoneStateListener, specifically paying attention to "onCallStateChanged method, and send commands to the media player as appropriate based on call state (pause when ringing, resume after hangup if so desired, etc).
精彩评论