android - How to Know if the incoming call is rejected or get missed -
i want detect if call missed or rejected using call state.
public void oncallstatechanged(int state, string incomingnumber) { super.oncallstatechanged(state, incomingnumber); switch (state) { case telephonymanager.call_state_idle: //when idle i.e no call if(flag==2){ toast.maketext(context,"missed call", toast.length_long).show(); flag=0; }else{ toast.maketext(context, "phone state idle", toast.length_long).show(); } break; case telephonymanager.call_state_offhook: // flag=0; // when off hook i.e in call // make intent , start service here toast.maketext(context, "phone state off hook", toast.length_long).show(); flag=1; break; case telephonymanager.call_state_ringing: //when ringing toast.maketext(context, "phone state ringing", toast.length_long).show(); flag=2; break; default: break; } }
and how can popup dialog box call_state_ringing?
when reach ideal after ringing read call logs , type of call if missed has type 3 , if rejected type 5
Comments
Post a Comment