Android Question revisiting question: any way to get the phone number?

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
hi

i know it was asked million times but still this is an open question
i know apps in play store some how manage to read the phone number of the device
is there any way to do this ?
how?

a small basic sample will be highly appreciated

thanks
 

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
also what are you trying to achive is doesn't make sence - if you want to use a phone number as an ID it's useless.

I have 5 Android phones. One that I'm using now and 4 that I used before. All of them shows the same phone number even though they are no longer connected to the network but keeping the SIM card.
you can't have 2 devices with same number - that's a fact
if you manage to fake a sim and go in air with 2 devices with same number both will be shut down by the operator
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
just an idea
is it possible to ask for the line2 number?
most phones have 2 sim slots
so i can put my sim in slot 2 and if i ask for line1 what will i get as result?
i think the best thing is to be able to get both lines
 
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
you can't have 2 devices with same number - that's a fact
if you manage to fake a sim and go in air with 2 devices with same number both will be shut down by the operator
I can have as many devices as I want, let's say I had LG for a few years. Then I upgraded it to Samsunbs S23. What happened to LG? It was disconnected and Samsung was connected. Right? But the phone number on the SIM card remains. Sp now we have 2 phones with the same phone number. But only one is cobbected to the provider.
 
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
you can't have 2 devices with same number - that's a fact
if you manage to fake a sim and go in air with 2 devices with same number both will be shut down by the operator
I didn't touch a sim card at all. The AT&T just disconnected LG and connected Samsung. If you go to settings->About phone you will see the phone number.
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
I can have as many devices as I want, let's say I had LG for a few years. Then I upgraded it to Samsunbs S23. What happened to LG? It was disconnected and Samsung was connected. Right? But the phone number on the SIM card remains. Sp now we have 2 phones with the same phone number. But only one is cobbected to the provider.
no
if you take the sim to another phone then the new phone has the number and the old phone has no number
the number is from the sim card
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
I didn't touch a sim card at all. The AT&T just disconnected LG and connected Samsung. If you go to settings->About phone you will see the phone number.
you can't have 2 phones with the same number
if they disconnected the LG it should have no line number or the line is disconnected so not much of a point to have its number as it is not alive
there is absolutely no option for 2 devices with the same number
 
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
no
if you take the sim to another phone then the new phone has the number and the old phone has no number
the number is from the sim card
I didn't touch a sim at all. It's still in the old phone since the provider inserted it many years ago. I can't make phone calls from this phone. But the phone number is the same as on the new phone. Even though the old phone is disconnected.
 
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
you can't have 2 phones with the same number
if they disconnected the LG it should have no line number or the line is disconnected so not much of a point to have its number as it is not alive
there is absolutely no option for 2 devices with the same number
but it is, I found a AT&T phone that I have before LG that is disconnected for many years and it's still shows that same phone number in settings.
 
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
Tested your code on my Samsung tablet from AT&T - it has a sim card and assigned phone number. You can't make calls and the sim card is just for the 5G. The line is disconnected now. Code worsk fine. Android 10.
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
but it is, I found a AT&T phone that I have before LG that is disconnected for many years and it's still shows that same phone number in settings.
sounds odd to me
ETSI states clearly what i said and it also logic - if you have an incoming call - who will ring?
both?
no way
they will both be cut of the network
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
Tested your code on my Samsung tablet from AT&T - it has a sim card and assigned phone number. You can't make calls and the sim card is just for the 5G. The line is disconnected now. Code worsk fine. Android 10.
i guess on older versions it will work
but i test on android 14 - did not work
did you try with debug mode or not?
i try with debug mode
but i don't think this is the issue
 
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
sounds odd to me
ETSI states clearly what i said and it also logic - if you have an incoming call - who will ring?
both?
no way
they will both be cut of the network
Samsung, the new one. LG is not connected to AT&T for more than a year.

Do you have only 1 phone? If you have more from the same account (let's say you upgraded and bought the new one) - check About Phone settings - you will be surprised.
I might be wrong since I have only AT&T phones.
 
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
i guess on older versions it will work
but i test on android 14 - did not work
did you try with debug mode or not?
i try with debug mode
but i don't think this is the issue
My Samsing has 14 - works. The only permiossion I was asked - permission to make phone calls.
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
Samsung, the new one. LG is not connected to AT&T for more than a year.

Do you have only 1 phone? If you have more from the same account (let's say you upgraded and bought the new one) - check About Phone settings - you will be surprised.
I might be wrong since I have only AT&T phones.
i know at&t they operate on gsm & sim card
i have many other phones but they are all with older android and i always test on the most recent to make sure it will work for all my clients
i really must have this issue solved it makes me crazy
 
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
i guess on older versions it will work
but i test on android 14 - did not work
did you try with debug mode or not?
i try with debug mode
but i don't think this is the issue
tried on Samsung (Android 14 connected to AT&T) in Re;ease mode - works fine.
tried on LG (Android 10 disconnected from AT&T) in Re;ease mode - works fine.
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
tried on Samsung (Android 14 connected to AT&T) in Re;ease mode - works fine.
tried on LG (Android 10 disconnected from AT&T) in Re;ease mode - works fine.
HMMM
maybe that's it
i try on debug mode
maybe it's like reading files like website or html that works only in release will try tomorrow and update
 
Upvote 0
Top