简体   繁体   English

Android应用程序访问android拨号程序

[英]Android app accessing the android dialer

Is it possible to access the dialer of android (mobile phone) from android app. 是否可以从android应用访问android(手机)的拨号程序。 Say if a user enters 001 in the app following by a telephone number, app should make the dialer of android(Mobile Phone) dial the number after 001...? 假设使用者在应用程式中输入001,然后再输入电话号码,则应用程式应让android(手机)的拨号器在001之后拨打号码...?

You can send an Intent which will open de phone dialer with supplied phonenumber. 您可以发送一个意图,该意图将使用提供的电话号码打开电话拨号程序。

http://developer.android.com/reference/android/content/Intent.html#ACTION_DIAL http://developer.android.com/reference/android/content/Intent.html#ACTION_DIAL

String url = "tel:1234";
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse(url));

Don't forget to add the permission to your manifest 不要忘记将权限添加到清单

<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>

You could try to send Intent with this action Intent.ACTION_DIAL(android.intent.action.DIAL) to see if it works. 您可以尝试通过此操作Intent.ACTION_DIAL(android.intent.action.DIAL)发送Intent,以查看其是否有效。 ACTION_DIAL tel:123 -- Display the phone dialler with the given number filled in. ACTION_DIAL tel:123-显示带有给定号码的电话拨号器。

Use below code hope it helps 使用下面的代码希望对您有所帮助

Intent sIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"+00189899989));
startActivity(sIntent);

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

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