Why do you need this? Are you trying to uniquely identify individual
installs? If so, what will you do if your user doesn't have a SIM in his
phone, or is  on a tablet? Search the list. Identifying installs uniquely
has been discussed before.

FYI, to see if the carrier stores the number on your SIM, go to Settings ->
About Phone -> Status -> My phone Number (In ICS. Other versions may vary
slightly.) If it displays unknown there, then your number is not stored on
the SIM.

Thanks

On Tue, Jan 3, 2012 at 4:46 PM, Upendra <[email protected]> wrote:

> I had given read phone state permission for this. still i am getting
> null not empty string.
>
> In android we can get sim serial number. So, is there any third API to
> get the mobile number which is associated with SIM serial number.
>
> On Jan 3, 6:47 am, Vadim <[email protected]> wrote:
> > Seems line a (lack of) permission problem. For GSM, the phone number
> > is on the SIM card, and some carriers just don't put it on the card,
> > and then the phone does not know what it is, but in this case you
> > should get an empry string rather than a null.
> >
> > On Jan 2, 3:18 am, Kristopher Micinski <[email protected]> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Some devices just do this,
> >
> > > what device are you using?
> >
> > > Also, you should have the read phone state permission for this, though
> > > if you didn't have it the result should be a security exception rather
> > > than this null behavior (unless I'm forgetting that the api silently
> > > checks for the permission, however, I think this is not the case...)
> >
> > > kris
> >
> > > On Mon, Jan 2, 2012 at 6:13 AM, Upendra Reddy Vuyyuru<
> [email protected]> wrote:
> > > > Hi All,
> >
> > > > I am trying to fetch the telephone number of the device. I am calling
> >
> > > > TelephonyManager.getLine1Number()  it always returns null.
> >
> > > > Thank you in advance....
> >
> > > > Regards
> > > > Upendra Reddy.V
> >
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to
> [email protected]
> > > > To unsubscribe from this group, send email to
> > > > [email protected]
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Raghav Sood
http://www.androidactivist.org/ - Author
http://www.appaholics.in/ - Founder

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to