简体   繁体   English

如何在不接听电话的情况下拨打紧急电话?

[英]How to call emergency number without accepting call?

I have a very specific problem. 我有一个非常具体的问题。 My app should implement calling emergency numbers (911, 112, etc.). 我的应用程序应实现紧急呼叫电话(911、112等)。 But this must perform immediately, without pressing "Call" button. 但这必须立即执行,而无需按“呼叫”按钮。 I've tried implement this via Intent: 我试过通过Intent实现此:

Intent intent = new Intent(Intent.ACTION_DIAL,Uri.parse("tel:" + getString(R.string.emd_emergency_number)));
startActivity(intent);

Finally, I see only dialer screen with number placed in number section. 最后,我只能看到在数字部分放置了数字的拨号程序屏幕。 Does anybody know, how to resolve this problem? 有人知道如何解决这个问题吗?

You can't do that. 你不能那样做。

Calling emergency numbers require CALL_PRIVILEGED permission which, according to the documentation is : 拨打紧急电话需要CALL_PRIVILEGED许可,根据文档所述,该许可为:

Not for use by third-party applications. 不适用于第三方应用程序。

Maybe it is usefull if let the user define a emergency number for himself(home,mum,wife,etc) instead of emergency number like 911,112. 如果让用户为自己(家,妈妈,妻子等)定义一个紧急电话号码,而不是像911,112这样的紧急电话号码,则可能很有用。 Because other numbers can be called with: 因为可以用以下方式调用其他号码:

public static final String ACTION_CALL 
Activity Action: Perform a call to someone specified by the data.

Input: If nothing, an empty dialer is started; else getData() is URI of a phone number    to be dialed or a tel: URI of an explicit phone number.

Output: nothing.

Note: there will be restrictions on which applications can initiate a call; most           applications should use the ACTION_DIAL.

Note: this Intent cannot be used to call emergency numbers. Applications can dial       emergency numbers using ACTION_DIAL, however.
Constant Value: "android.intent.action.CALL"

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

暂无
暂无

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

相关问题 我想在 ACTION_CALL 的帮助下按下我的移动应用程序中的按钮来拨打紧急号码,但我没有。 为什么? - i want to make call on an emergency number by pressing the button in my mobile app with help of ACTION_CALL but i didn't. why? Android-如何使用Intent.ACTION_CALL激活紧急呼叫电话? - Android - How to activate calling Emergency numbers using Intent.ACTION_CALL? 使用android拨打电话而无需离开应用 - Call a phone number with android without leaving app 给定数字N,如何调用递归调用N次? - how to call a recursion call N number of times, given the number N? 如何自动拨打数字键盘? - How to call number keyboard automatically? 如何在没有警告的情况下调用构造函数? - How to call a constructor without warnings? 如何在不使Mockito进行额外调用的情况下使用Mockito检查对函数的调用次数 - How to use Mockito to check number of calls to a function without making Mockito make an extra call 如何通过部署在没有数据库的多个服务器上的服务为每个呼叫生成一个 16 位唯一号码? - How to generate a 16 digit unique number for each call by a service deployed on multiple servers without database? 如何强制Java调用接受非不可参数的重载Kotlin方法? - How do I force a Java call to overloaded Kotlin method accepting a non-nulllable parameter? 如何在不使用异步通话的情况下在Android中进行网络通话? - How to make a network call in Android without using an async call?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM