how to add a dial number and press the `call` bottom?

亡梦爱人 提交于 2021-02-05 12:20:42

问题


I want to trigger an intent that opens the dialer adds a number and then

presses the call bottom.

Is there any way to do the press bottom ?

private void SendDialIntent() {
    Intent intent = new Intent(Intent.ACTION_DIAL);
    intent.setData(Uri.parse("tel:" + phone.phone));
    startActivity(intent);
}

回答1:


You cannot "press the call button". You can use ACTION_CALL (instead of ACTION_DIAL), which will directly place the phone call. This requires the CALL_PHONE permission and will not work for emergency numbers (e.g., 911 in the US).



来源:https://stackoverflow.com/questions/27830232/how-to-add-a-dial-number-and-press-the-call-bottom

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