Automatically open dialpad on incoming / outgoing call

末鹿安然 提交于 2019-12-23 05:28:04

问题


I was thinking of making a small background utility, which detects when either phone receives an incoming call / user makes an outgoing call. Based on the action, the numeric dialpad is displayed automatically when the phone is taken away from the ear.

I know, how to detect the type of call, but then don't know, if it's possible to trigger an Intent action to ask android to open the dialpad programatically.

Pls suggest, if its possible and how.

Thanks Omkar Ghaisas


回答1:


yes it is posible create a broad cast reciever liten for incoming call then in onrecieve write down this code it will open a dial pad

Intent dial = new Intent();
dial.setAction("android.intent.action.DIAL");
dial.setData(Uri.parse("tel:"));
dial.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
context.startActivity(dial);

and for broadcast and services read this http://www.vogella.de/articles/AndroidServices/article.html

also check

http://androidsourcecode.blogspot.in/2010/10/blocking-incoming-call-android.html



来源:https://stackoverflow.com/questions/9925076/automatically-open-dialpad-on-incoming-outgoing-call

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