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

Java 如何在不接电话的情况下拨打紧急电话号码?,java,android,Java,Android,我有一个非常具体的问题。我的应用程序应该实现拨打紧急电话911、112等。。但这必须立即执行,无需按下呼叫按钮。我已尝试通过意图实现此功能: Intent intent = new Intent(Intent.ACTION_DIAL,Uri.parse("tel:" + getString(R.string.emd_emergency_number))); startActivity(intent); 最后,我只看到拨号器屏幕上的数字放在数字部分。 有人知道如何解决这个问题吗?你不能那样做 拨

我有一个非常具体的问题。我的应用程序应该实现拨打紧急电话911、112等。。但这必须立即执行,无需按下呼叫按钮。我已尝试通过意图实现此功能:

Intent intent = new Intent(Intent.ACTION_DIAL,Uri.parse("tel:" + getString(R.string.emd_emergency_number)));
startActivity(intent);
最后,我只看到拨号器屏幕上的数字放在数字部分。 有人知道如何解决这个问题吗?

你不能那样做

拨打紧急电话需要许可,根据文件规定,该许可是:

不供第三方应用程序使用

你不能那样做

拨打紧急电话需要许可,根据文件规定,该许可是:

不供第三方应用程序使用


如果让用户为自己的家、妈妈、妻子等定义一个紧急电话号码,而不是像911112这样的紧急电话号码,可能是有用的。 因为其他号码可以通过以下方式调用:

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"

如果让用户为自己的家、妈妈、妻子等定义一个紧急电话号码,而不是像911112这样的紧急电话号码,可能是有用的。 因为其他号码可以通过以下方式调用:

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"

你不能给紧急电话号码打电话。你不能给紧急电话号码打电话。我已经应用了如下权限:'',但它不起作用。但文档说明,此权限不能授予第三方应用程序。因此,@njzk2,我无法在不接受的情况下通过我的应用程序拨打紧急电话号码?您只能拨打,不能拨打实际电话。您也可以参考行动电话的文档:此意图不能用于拨打紧急电话。但是,应用程序可以使用ACTION_dial拨打紧急电话号码。我已经应用了以下权限:“”,但它不起作用。但文档说明,无法将此权限授予第三方应用程序。因此,@njzk2,我无法在不接受的情况下通过我的应用程序拨打紧急电话号码?您只能拨打,不打实际的电话。您也可以参考行动电话的文档:此意图不能用于拨打紧急电话。然而,应用程序可以使用操作拨号拨打紧急电话。