5 Replies - 18534 Views - Last Post: 25 September 2010 - 11:30 AM

#1 Guest_Gibbsnich*


Reputation:

Android: Can an app read the own phone number ?

Posted 20 August 2010 - 12:53 AM

Hello,

with my app, users can connect to their company servers by internet and can access the ERP-System. Obviously this is not an open account and we want to verify authorization.

A simple way is to check the mobile phone number. This number is easy to mantain, as everone knows his number, but no one knows his IMEI.

But how can I read this number within my App.
I suppose, I have to read infos from the simcard ?

TIA

Gibbsnich

Is This A Good Question/Topic? 0

Replies To: Android: Can an app read the own phone number ?

#2 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,960
  • Joined: 21-March 08

Re: Android: Can an app read the own phone number ?

Posted 20 August 2010 - 07:20 AM

Try out this link and see if it helps...

http://www.higherpas...droid-Contacts/
Was This Post Helpful? 0
  • +
  • -

#3 Guest_Guest*


Reputation:

Re: Android: Can an app read the own phone number ?

Posted 23 August 2010 - 07:29 AM

MMmmmhh...
..as far as I can see, I can read any information which is stored in the contacts-area.
But I'm not looking for the telephone numbers from my contacts, but for my own number, which probalbly is stored on the simcard.
Was This Post Helpful? 0

#4 bastecklein  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 08-October 09

Re: Android: Can an app read the own phone number ?

Posted 31 August 2010 - 09:20 AM

What if the user is on a non-phone Android device?
Was This Post Helpful? 0
  • +
  • -

#5 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,960
  • Joined: 21-March 08

Re: Android: Can an app read the own phone number ?

Posted 31 August 2010 - 12:47 PM

View Postbastecklein, on 31 August 2010 - 12:20 PM, said:

What if the user is on a non-phone Android device?


then you won't be able to use the Android API to get the phone number.

just to answer the question, found this over on StackOverflow

TelephonyManager tMgr =(TelephonyManager)mAppContext.getSystemService(Context.TELEPHONY_SERVICE);
mPhoneNumber = tMgr.getLine1Number();



It may not always return the correct number, but it's a start.
Was This Post Helpful? 0
  • +
  • -

#6 nimajneb  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 11
  • View blog
  • Posts: 116
  • Joined: 04-August 10

Re: Android: Can an app read the own phone number ?

Posted 25 September 2010 - 11:30 AM

Found this little gem.

http://www.anddev.or...e_ids-t446.html

Hope it helps
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1