2

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?

Kara
  • 6,115
  • 16
  • 50
  • 57
Jakub Szczygieł
  • 1,203
  • 1
  • 13
  • 26

1 Answers1

2

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.

Jakub Szczygieł
  • 1,203
  • 1
  • 13
  • 26
  • i am having the exact same issue, i made another if statement to check if mobile became idle when the outgoing call ends to save duration and i also tried to check for number but didnt work gives null! – TDSii Aug 13 '11 at 23:01
  • in my case it was phone state as listed: idle > ringing > offhook > idle in first idle there was extra data with phone number – Jakub Szczygieł Aug 16 '11 at 12:47