简体   繁体   English

使用标准的电话应用程序来“完成操作”,以便在android中拨打电话

[英]use standard phone app to “complete an action” of phone call in android

I have Skype installed on my device so when i run such a code 我在设备上安装了Skype,因此当我运行这样的代码时

String numb = prefs.getString("top_number", "+380931112223");
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:+" + numb));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_FROM_BACKGROUND);
startActivity(intent);    

system throws dialog with question what app to use to complete an action: Phone or Skype. 系统会引发对话框,询问要使用哪个应用程序来完成操作:电话或Skype。 How can i avoid this and use standard Phone app programmatically? 如何避免这种情况并以编程方式使用标准的Phone应用程序?

You can't. 你不能 This is default Android behavior for dealing with a certain action ( Intent.ACTION_CALL in your case). 这是处理特定操作(在您的情况下为Intent.ACTION_CALL )的默认Android行为。 When you are presented with the dialog, you can choose an app for that time only or set the chosen app as default. 出现对话框时,您只能选择该时间的应用程序或将所选的应用程序设置为默认应用程序。 If the latter option is chosen and you run your code again, the app opens immediately instead of showing the dialog 如果选择了后一个选项,并且您再次运行代码,则应用程序将立即打开,而不显示对话框

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM