How to get outgoing call number in android? [dupli

2020-07-25 01:16发布

I am trying to get outgoing call number with intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER), but every time I try it returns null. I did put needed permissions and action in Androidmanifest. Can someone tell me what I am doing wrong or how to retrive number another way?

标签: java android
1条回答
家丑人穷心不美
2楼-- · 2020-07-25 01:47

Ok, I found out what was wrong.

First of all intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER) gives you outgoing number while phone state is idle and turns to "null" while phone status changes to OFF_HOOK.

The easiest way was to save the number before another onRecive happens.

查看更多
登录 后发表回答