android:如何通过android应用程序调用该号码

Har*_*jar 40 android

可能重复:
如何在Android中使用intent进行电话呼叫?

请给我通过android应用程序调用号码的代码.

非常感谢

DKI*_*KIT 118

Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:123456789"));
startActivity(callIntent);
Run Code Online (Sandbox Code Playgroud)

编辑:还必须添加<uses-permission android:name="android.permission.CALL_PHONE" />Manifest.

  • 必须在Manifest中添加`<uses-permission android:name ="android.permission.CALL_PHONE"/>`. (13认同)
  • 使用**Intent.ACTION_DIAL**而不是`Intent.ACTION_CALL`你可以摆脱`Manifest`中的权限 (3认同)

小智 71

试试这个,

Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:123456789"));
startActivity(callIntent);
Run Code Online (Sandbox Code Playgroud)

请记住将此CALL_PHONE权限添加到您的manifest.xml:

<uses-permission android:name="android.permission.CALL_PHONE" />
Run Code Online (Sandbox Code Playgroud)

这可能对你有所帮助.