i want make phone call , after call ends want come activity
started call.
code start call :
// start call intent callintent = new intent(intent.action_call); callintent.setdata(uri.parse("tel:" + phonenumber)); startactivity(callintent);
code handle coming activity :
// monitor phone call activities private class phonecalllistener extends phonestatelistener { private boolean isphonecalling = false; string tag = "phonecalllistener"; @override public void oncallstatechanged(int state, string incomingnumber) { // if call ringing if (state == telephonymanager.call_state_ringing) { log.d(tag, "call ringing, number : " + incomingnumber); } // else if call active else if (state == telephonymanager.call_state_offhook) { log.d(tag, "call active"); isphonecalling = true; } // else if call idle else if (state == telephonymanager.call_state_idle) { log.d(tag, "call idle"); if (isphonecalling) { isphonecalling = false; // finish native call application come // activity intent = new intent(getintent()); i.setflags(intent.flag_activity_single_top); startactivity(i); } } } }
using finish()
not work. stays on call application.
how come activity
started phone call?
Comments
Post a Comment