开发者

How to handle a call in android media player? [duplicate]

This question already has an answer here: Closed 11 years ago.

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).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜