wood burning stoves 2.0*
The moose likes Android and the fly likes How to fetch own mobile number in android Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "How to fetch own mobile number in android" Watch "How to fetch own mobile number in android" New topic
Author

How to fetch own mobile number in android

Vimal Rajpara
Greenhorn

Joined: Jan 20, 2011
Posts: 4
I want to get mobile number of own mobile.

I searched android telephony class but i can not find any useful function over there.

thanks in advance for your help.

Thanks,
Vimal Rajpara
Pratik Goswami
Ranch Hand

Joined: Mar 02, 2009
Posts: 136

Hi Vimal,
Hope you are fine.

This link is the solution of your problem



Thanks & Regards
Pratik Goswami


iOS * Android Developer
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41017
    
  43
This link is the solution of your problem

Not necessarily. That number can be the original phone number of the device, which becomes invalid if another (pre-existing) phone number gets ported to the phone - which is a common occurrence. I've also seen it reported as being "null" (which is OK according to the javadocs).


Ping & DNS - my free Android networking tools app
Pratik Goswami
Ranch Hand

Joined: Mar 02, 2009
Posts: 136

Ulf,

This is post condition, but something is there from which it can be accessed and achieved.
Returns the phone number string for line 1, for example, the MSISDN for a GSM phone. Return null if it is unavailable.


Thanks & Regards
Pratik Goswami
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41017
    
  43
This is post condition, but something is there from which it can be accessed and achieved.

I don't understand what you're trying to say here, but the important point is: No value may be returned, and even if a value is returned, it may not be the correct one.
Vimal Rajpara
Greenhorn

Joined: Jan 20, 2011
Posts: 4
Thanks Pratik & Ulf for yours reply.

I am very much fine

as per my findings, both are right : if we have number listed in About Phone section of android then only we can get number other wise we get null.

The second thing i come across :- i checked one Android Mobile(@Pratik : its amitesh mobile) in that mobile owner changed its sim card but MSISDN number(mobile number) did not changed , it remain old sim card number. So in this scenario we can get mobile number of our own but old number.

 
 
subject: How to fetch own mobile number in android
 
Similar Threads
Help with a program
Reg: Android GAME API
Which is best platform for devlopers for mobile apps ?
Android on today devices
Mobile for Android 3.1 version