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?
got an idea - did you use my project as-is to test or you used your own or did any modification to my code?
will it be possible for you to upload your entire test project in zip so i can test it as-is on my phone?
thanks
Well, I tried the code in post #10,
Device: Tecno Running Android 13,
After Granting Permission, Other information's came except Phone number which is empty
Well, I tried the code in post #10,
Device: Tecno Running Android 13,
After Granting Permission, Other information's came except Phone number which is empty
Well, from my assessment and test, your code works fine.
I switched the SIMs and the number came.
OBSERVATION
The number is provided from the Network Operator. In My Case
1. Vodafone Network does NOT load the phone number hence its not retrieved.
2. MTN Network has the number provided hence it is RETRIEVED. As you can see in the SIM Manager under Settings
Well, from my assessment and test, your code works fine.
I switched the SIMs and the number came.
OBSERVATION
The number is provided from the Network Operator. In My Case
1. Vodafone Network does NOT load the phone number hence its not retrieved.
2. MTN Network has the number provided hence it is RETRIEVED. As you can see in the SIM Manager under Settings
in my case i do get the number on the phone so it seems something else
today i will check with another sim from another operator
one big question - the function refers to line1 - what about line2?
many have 2 sims or put the sim in slot #2
so how do i manage to check both slot #1 and slot #2?
ok
tested on another phone (android 10) and another sim from another operator - no phone number!
when i checked in sim settings i saw that the number is also missing and i can add it manually, so i did
now the phone displays the number i entered
but still the app shows an empty string
tried it in slot #1 & slot #2
same results
then i went "wild" and tested on older device with android 9
same result - no phone number
so i started to lower the target sdk from 33 to 30 and then to 29
same results - no phone number
then i tried even to see if i can get Device Id & Subscriber ID - on android 9 i did
on 10 it produced an error (obviously)
this happened with all SDK versions i tried
so no option returned phone number under any sdk or any android version
my conclusion is that it is all in the code - i must be doing something wrong
as in android 9 i don't think this was blocked especially in such older sdks and as proof i managed to get Device Id & Subscriber ID on android 9 but still no phone num