android 如何判断去电或来电已经接通

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

                1、在CallNotifier.java (packages\apps\Phone\src\com\android\phone)中定义一个成员变量private Call.State mLastCallState = Call.State.IDLE;
2、在函数onPhoneStateChanged的开始添加代码
Call.State ringCallState = mCM.getFirstActiveRingingCall().getState();
Call.State fgCallState = mCM.getActiveFgCallState();
if ((mLastCallState.isRinging() && ringCallState == Call.State.IDLE) || //MT
   (mLastCallState.isDialing() && fgCallState == Call.State.ACTIVE)) //MO
{
// 进入这里意味着电话已经接通,sergeycao一些操作
}
mLastCallState = ringCallState.isRinging()  ringCallState:fgCallState;           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

这里写图片描述

你可能感兴趣的:(android 如何判断去电或来电已经接通)