public static void call(Context context, int id, String telNum, @Nullable String action){
TelecomManager telecomManager = null;
List<PhoneAccountHandle> phoneAccountHandleList = null;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {//版本在21及以上
telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
if(telecomManager != null) {
phoneAccountHandleList = telecomManager.getCallCapablePhoneAccounts();
}
}
Intent intent = new Intent();
intent.setAction(action);
intent.setData(Uri.parse(telNum));
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {//版本在23及以上
if (phoneAccountHandleList != null) {
intent.putExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, phoneAccountHandleList.get(id));
}
}
context.startActivity(intent);
}
1 个回复
FullStack - 【插件开发】【专治疑难杂症】【ios上架、马甲包、白包、过审、已成功上架过几百个】【多款插件已上架:https://ext.dcloud.net.cn/publisher?id=22130】【非诚勿扰】QQ:543610866
可以做