I want to use phone number as user ID,so i want to access the phone
number.
in my code,  i can get IMSI (International Mobile Subscriber Identity)
by using getSubscriberId().
but can not get  MSISDN by using  getLine1Number(),it returns null.

 my test phone is HTC G3,
anybody can solve the problem?

thanks!


  TelephonyManager tm = (TelephonyManager) getSystemService
(Context.TELEPHONY_SERVICE);

        String phoneNumber = tm.getLine1Number();
        if(phoneNumber == null || phoneNumber.trim().equals("")){
                phoneNumber = "cann't get the phone number";
                }


// permission has been added in Manifest
 <uses-permission android:name="android.permission.READ_PHONE_STATE" />

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to