End Call in Android -
i'm trying end new outgoing call after few seconds. here code:
public class phonecalls extends activity { componentname cn; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); call(); } private void call() { try { intent callintent = new intent(intent.action_call); callintent.setdata(uri.parse("tel:123456789")); startactivity(callintent); cn = new componentname(getapplicationcontext(), receiver.class); } catch (activitynotfoundexception activityexception) { log.e("dialing-example", "call failed", activityexception); } } }
my receiver class is:
public class receiver extends broadcastreceiver { public void onreceive(context context, intent intent) { if (intent.getaction().equals(intent.action_new_outgoing_call)) { setresultdata(null); } } }
i unable abort outgoing call. i'm new android , can't seem work.
you can't end call in android. @ moment calling startactivity(callintent) giving control native caller application. call can aborted through phone application.
besides code after starting call not make sense. not doing componentname creating, onreceive method of receiver never called. if receiver called code in onreceive method won't alter state of phone call.
Comments
Post a Comment