通过下面的代码,我创建了被遗漏或拒绝的 incommingCall
public class Call_Receiver extends BroadcastReceiver {
public static Context ctx;
@Override
public void onReceive(Context arg0, Intent arg1) {
ctx = arg0;
OutgoingIncomingCallListener phoneListener = new OutgoingIncomingCallListener();
TelephonyManager telephony = (TelephonyManager) ctx
.getSystemService(Context.TELEPHONY_SERVICE);
telephony.listen(phoneListener,
PhoneStateListener.LISTEN_CALL_STATE);
}
class OutgoingIncomingCallListener extends PhoneStateListener {
public boolean myGoal ;//my goal is Call received and (missed or rejected)
@Override
public void onCallStateChanged(int state, String incomingNumber) {
super.onCallStateChanged(state, incomingNumber);
switch(state){
case TelephonyManager.CALL_STATE_IDLE:
Log.d("fff","IDLE");
if (myGoal == true)
{
//so call is missed or rejected
}
break;
case TelephonyManager.CALL_STATE_OFFHOOK:
myGoal =false;
Log.d("fff","OFFHOOK");
break;
case TelephonyManager.CALL_STATE_RINGING:
Log.d("fff","RINGING");
myGoal = true;
break; }
}
}
}
但是我只想找到rejected Call?怎么办?
是否可以在 Android 中检测被拒绝的呼叫?
通过上面的链接,我们检查它的通话记录。
但是当我们检查 calllog 时;我的电话尚未插入拒绝列表。
又怎样?