如何结束我的去电。
使用 statrtActivity(callIntent) ,通话开始,然后我必须等待几秒钟并自动结束。为了结束我的通话,我采取了 mycalss 扩展 Broadcastreceiver 然后在我实现的 onreceive()
中。在该方法中,我只需设置旧号码和新号码,并且 toast 正在打印。 我真正想要的是结束调用我需要写的内容。以及如何从我的班级调用 onreceive 方法?请帮助我。我什么也没得到。
@Override
public void onReceive(Context context, Intent intent) {
final String oldNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
this.setResultData(newPhNnumber);
final String newNumber = this.getResultData();
if((newNumber!=null)&&(newNumber!=oldNumber))
{
String msg = "Intercepted outgoing call. Old number " + oldNumber + ", new number " + newNumber;
Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
this.abortBroadcast();----> what it does?
}
with statrtActivity(callIntent)
, call goes and then i have to wait for few seconds and end automatically. to end up my call i have taken mycalss extends Broadcastreceiver then in that onreceive()
i implemented.in that method i got only to set old number and newnumber and toast is printing.
What i want exactly is to end call what i need to write. and how to call onreceive method from my class? plase help me. i didnt get anywhere.
@Override
public void onReceive(Context context, Intent intent) {
final String oldNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
this.setResultData(newPhNnumber);
final String newNumber = this.getResultData();
if((newNumber!=null)&&(newNumber!=oldNumber))
{
String msg = "Intercepted outgoing call. Old number " + oldNumber + ", new number " + newNumber;
Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
this.abortBroadcast();----> what it does?
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以试试这个:
You may try this:
您只需通过以下代码中止拨出呼叫
you simply abort outgoing call through following code