簡體   English   中英

Android應用程序訪問android撥號程序

[英]Android app accessing the android dialer

是否可以從android應用訪問android(手機)的撥號程序。 假設使用者在應用程式中輸入001,然后再輸入電話號碼,則應用程式應讓android(手機)的撥號器在001之后撥打號碼...?

您可以發送一個意圖,該意圖將使用提供的電話號碼打開電話撥號程序。

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));

不要忘記將權限添加到清單

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

您可以嘗試通過此操作Intent.ACTION_DIAL(android.intent.action.DIAL)發送Intent,以查看其是否有效。 ACTION_DIAL tel:123-顯示帶有給定號碼的電話撥號器。

使用下面的代碼希望對您有所幫助

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