By below code I founded incommingCall that is missed or rejected
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; }
}
}
}
But I only want to found rejected Call?How do it?
Is it possbile to detect rejected calls in Android?
by above link we check calllog for it .
but when we check calllog ; my call not inserted into rejected list yet.
so how?