Call 911 in Android

只愿长相守 提交于 2019-11-30 12:46:47

The code provided should already work for this, but you need the CALL_PHONE and CALL_PRIVILEGED permission to dial emergency numbers without showing the dial-pad.

Android Reference - Manifest Permission CALL_PRIVILEGED

Once that is added to the manifest, you should be able to use the same code using the ACTION_CALL instead to direct dial:

Uri callUri = Uri.parse("tel://911");
Intent callIntent = new Intent(Intent.ACTION_CALL,callUri);
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_NO_USER_ACTION);
startActivity(callIntent);

Action_Dial will open the dialpad, Action_Call will call directly..

However, a quote from ACTION_CALL:

Note: this Intent cannot be used to call emergency numbers. Applications can dial emergency numbers using ACTION_DIAL, however.

Say Intent.ACTION_CALL insted of Intent.ACTION_DIAL this will call number without showing it on dial pad.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!