Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:123456789"));
startActivity(callIntent);
编辑:在清单文件中也必须添加<uses-permission android:name="android.permission.CALL_PHONE" />
。
试试这个,
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:123456789"));
startActivity(callIntent);
记得在你的manifest.xml
中添加这个CALL_PHONE
权限:
<uses-permission android:name="android.permission.CALL_PHONE" />
这可能会对你有所帮助。
<uses-permission android:name="android.permission.CALL_PHONE" />
来申请拨打电话权限。 - MikaIntent.ACTION_CALL
,这样您就可以摆脱在Manifest
中需要的权限。 - NecipAllef