简体   繁体   English

通过Android应用拨打电话

[英]Making Phone call from Android app

I set on my Android a new default dialer. 我在Android上设置了新的默认拨号程序。 I created an app that make a phone call by click on button that use this code: 我创建了一个应用程序,该应用程序通过单击使用以下代码的按钮来拨打电话:

Intent callIntent=new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:123"));
startActivity(callIntent);

But, when I lunch the func of make a call, the call goes out via the old default dialer and not from the new dialer I set as default. 但是,当我在午餐时拨打电话时,呼叫会通过旧的默认拨号器发出,而不是从我设置为默认的新拨号器中发出。

My question is how can I make the call goes out via the new dialer I set as default? 我的问题是如何通过设置为默认值的新拨号器发出呼叫?

也许您想使用Intent.ACTION_DIAL而不是Intent.ACTION_CALL

The way you use is the right one. 您使用的方法是正确的方法。 The difference between Intent.ACTION_DIAL and Intent.ACTION_CALL is that the first one allows the user to explicitly initiate the call showing the dialer UI. Intent.ACTION_DIALIntent.ACTION_CALL之间的区别在于,第一个允许用户显式发起显示拨号程序UI的呼叫。 Maybe your custom dailer does not support the intent you send, and because of that there is only one app responding (the default dailer) and Android forwards you there. 也许您的自定义Dailer不支持您发送的意图,因此,只有一个应用程序在响应(默认Dailer),Android会将您转发给您。 Otherwise a pop-up would open and let you choose which dailer to use. 否则,将弹出一个弹出窗口,让您选择要使用的Dailer。

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

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