无法使用 Intent 拨打电话 Android
Not able to make call using Intent Android
我正在尝试使用 intent 进行调用,如果我尝试 运行 来自 linux eclipse 的代码其工作正常,但在 windows eclipse 上它不起作用。这是我的代码
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:"+"1234567890"));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
尝试将此用于 Windows。它可能对你有帮助
// TODO Auto-generated method stub
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:"
+ Uri.encode("Your Number here")));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
试试这个来打电话
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:" + "9876543210"));
startActivity(callIntent);
并在清单文件中添加此权限
<uses-permission android:name="android.permission.CALL_PHONE"/>
我正在尝试使用 intent 进行调用,如果我尝试 运行 来自 linux eclipse 的代码其工作正常,但在 windows eclipse 上它不起作用。这是我的代码
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:"+"1234567890"));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
尝试将此用于 Windows。它可能对你有帮助
// TODO Auto-generated method stub
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:"
+ Uri.encode("Your Number here")));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
试试这个来打电话
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:" + "9876543210"));
startActivity(callIntent);
并在清单文件中添加此权限
<uses-permission android:name="android.permission.CALL_PHONE"/>