我使用 android.media.MediaPlayer
对象播放音频文件在我的应用程序。一切工作正常,但是当电话在歌曲播放的应用程序不会暂停媒体播放器,你可以听到在通话过程中的歌曲来。请告诉我如何暂停媒体播放器上的一个电话,然后重新恢复它通话结束后。
I am using android.media.MediaPlayer
object to play audio files in my app. Everything works fine but when a phone call comes while a song is playing the app does not pause the media player and you can hear the song during the phone call. Please tell me how to pause media player on a phone call and again resume it after call is ended.
使用 PhoneStateListener
来找出当手机正在使用中。
Use a PhoneStateListener
to find out when the phone is in use.