[英]dial a number automatically in android
I can't figure out how to make the app dial. 我不知道如何进行应用拨号。
I have this code: 我有以下代码:
public void dial(String number)
{
Intent intent = new Intent(Intent.ACTION_DIAL);//calling intent
intent.setData(Uri.parse("tel:" + number));
if (intent.resolveActivity(getPackageManager()) != null)
{
startActivity(intent);
}
}
but it only opens the dialer app. 但它只会打开拨号程序。 i need it to dial the given number.. 我需要它拨打给定的号码。
any help would be appreciated!! 任何帮助,将不胜感激!!
Change ACTION_DIAL
to ACTION_CALL
. 将ACTION_DIAL
更改为ACTION_CALL
。 This will require the CALL_PHONE
permission. 这将需要CALL_PHONE
权限。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.