如何直接拨打电话? [英] How to make a call directly?

查看:121
本文介绍了如何直接拨打电话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用此代码时,首先是带有该号码的拨号盘屏幕.

when I use this code, first comes the dial pad screen with this number.

Intent dialintnt = new Intent(Intent.ACTION_DIAL,Uri.parse("tel:911"));
startActivityForResult(dialintnt, CALLING);

我不想要那个屏幕.当我单击直接拨打该号码的按钮时,我想要那个. 那么我怎样才能拨打电话号码onclick?

I don't want that screen. I want that when I click button directly calling that number. So how can I call a number onclick?

推荐答案

请参见答案

您将需要添加CALL_PHONECALL_PRIVILEGED权限以清单文件.

You will need add CALL_PHONE and CALL_PRIVILEGED permissions to manifest file.

然后可以使用以下方式拨打该号码:

Then the number can be called using:

Uri callUri = Uri.parse("tel://911");
Intent callIntent = new Intent(Intent.ACTION_CALL,callUri);
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_NO_USER_ACTION);
startActivity(callIntent);

这篇关于如何直接拨打电话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆