/**
* Listener to check incoming call
*/
private void initPhoneListener() {
final PhoneStateListener phoneStateListener = new PhoneStateListener() {
@Override
public void onCallStateChanged(int state, String incomingNumber) {
if (state == TelephonyManager.CALL_STATE_RINGING) {
pauseMedia();
} else if (state == TelephonyManager.CALL_STATE_IDLE) {
isInCall = false;
if (isFirstStart == false) {
if (Build.VERSION.SDK_INT >= 17.0) {
bigNotification = true;
largeMediaPlayer = LargeMediaPlayer.getInstance(context);
} else {
bigNotification = false;
smallMediaPlayer = SmallMediaPlayer.getInstance(context);
}
resumeMedia();
}
isFirstStart = false;
}
super.onCallStateChanged(state, incomingNumber);
}
};
telephoneManger = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (telephoneManger != null) {
telephoneManger.listen(phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
}
}
AudioManager.java 文件源码
java
阅读 31
收藏 0
点赞 0
评论 0
项目:QuranAndroid
作者:
评论列表
文章目录