[英]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.