开发者

Keypress event listener for android dialler

Can someone give me a tip on how to capture the values pr开发者_Python百科esses on the android dial pad? I think i should use a broadcast receiver for it


Are you trying to capture the values for a dialler related app? If you are, you can just capture the whole dialled string (ON_NEW_OUTGOING_CALL event) using getResultData(). If this returns null, you can then use intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER).

From memory you need the PROCESS_OUTGOING_CALL permission, and possibly some others, set in your manifest.

At this point, if you want to do anything with the number, you can modify the string and then just setResultData(newNumberString);

The only adendum at this point is that setResultData doesn't work with phones using the sense interface. With those, you actually need to start a new intent to be able to dial(until HTC finally open up their dev website..)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜