我需要在Android应用中实现调用功能,而不使用 Intent.ACTION_CALL ........或现有的调用应用 ..... Pl分享建议或演示代码
答案 0 :(得分:0)
使用此功能
public static void makeCall(Context context, String number) {
if (!TextUtils.isEmpty(number)) {
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + number));
PackageManager manager = context.getPackageManager();
List<ResolveInfo> infos = manager.queryIntentActivities(intent, 0);
if (infos.size() > 0) {
context.startActivity(intent);
} else {
Toast.makeText(context, "Please install a dialer app", Toast.LENGTH_LONG).show();
}
} else {
Toast.makeText(context, "Please add phone number to make a call", Toast.LENGTH_LONG).show();
}
}