我有一个非常具体的问题。我的应用程序应该实现呼叫紧急号码(911,112等)。但这必须立即执行,而不必按“呼叫”按钮。我试过通过Intent实现这个:
Intent intent = new Intent(Intent.ACTION_DIAL,Uri.parse("tel:" + getString(R.string.emd_emergency_number)));
startActivity(intent);
最后,我看到只有数字部分放置号码的拨号屏幕。 有谁知道,如何解决这个问题?
答案 0 :(得分:8)
答案 1 :(得分:1)
如果让用户为自己(家庭,妈妈,妻子等)定义紧急电话号码而不是像911,112这样的紧急电话号码,也许它很有用。 因为可以使用以下方法调用其他数字:
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