Android Intent.ACTION“您的呼叫会启动skype呼叫,而不是”呼叫;“正常”;电话
我有以下代码,我从一个对话框片段按钮开始:Android Intent.ACTION“您的呼叫会启动skype呼叫,而不是”呼叫;“正常”;电话,android,android-intent,Android,Android Intent,我有以下代码,我从一个对话框片段按钮开始: uri = "tel:"+ServerDialogCallUs.this.contents.getString("phone_number"); Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(Uri.parse(uri)); 此代码将启动skype呼叫,而不是拨打普通电话。如何让用户在普通通话和skype通话之间进行选择。 谢谢,那是因为 只有skype安装为电话处
uri = "tel:"+ServerDialogCallUs.this.contents.getString("phone_number");
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse(uri));
此代码将启动skype呼叫,而不是拨打普通电话。如何让用户在普通通话和skype通话之间进行选择。 谢谢,那是因为
在后一种情况下,请转到“设置”、“应用程序”、“skype”,并删除应用程序详细信息屏幕底部的关联。您的手机可能将skype作为默认应用程序来处理
意图。操作\u呼叫
实际上,我缺少权限:
<uses-permission android:name="android.permission.CALL_PHONE" />
将此权限添加到清单后,我可以在普通呼叫和skype呼叫之间进行选择。
谢谢请尝试以下代码:
uri = "tel:"+ServerDialogCallUs.this.contents.getString("phone_number");
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse(uri));
startActivity(Intent.createChooser(intent, "Call Using..."));
尝试调用setPackage()方法,工作正常:
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setPackage("com.android.phone");
intent.setData(Uri.parse("tel:" + number));
startActitivy(intent);
有同样的问题并尝试了一些答案:
final Intent intent = new Intent();
intent.setAction(Intent.ACTION_DIAL);
intent.setData(Uri.fromParts("tel", "123456", null));
startActivity(Intent.createChooser(intent, ""), REQUEST_CODE));
在我看来
intent.setPackage("com.android.phone");
取决于设备,或者至少没有在我的设备上保留“电话”。有趣的是,该权限实际上并不取决于使用action\u call,而是取决于实际应用程序的使用,因此允许拨打skype电话,但不允许拨打普通电话。添加此权限后,我可以选择默认操作,谢谢。“我如何才能让用户在正常通话和skype通话之间进行选择。”此解决方案不会给用户该选项,是吗?