getLine1Number() returns null

Put your problem here if it does not fit any of the other categories.

getLine1Number() returns null

Postby burakkilic » Sat Dec 05, 2009 6:22 pm

Hi. I give READ_PHONE_STATE permission and trying to get my phone number with

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public String getMyPhoneNumber(){
  2.  
  3.                 TelephonyManager telephonyManager;  
  4.  
  5.                 telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);  
  6.  
  7.                 return telephonyManager.getLine1Number();  
  8.  
  9.         }
  10.  
  11.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

but I receive null. Where am I wrong?
burakkilic
Developer
Developer
 
Posts: 37
Joined: Thu Oct 01, 2009 10:24 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 24 guests