Re: [android-developers] Re: Cannot get PhoneNumber on Real device but code works in Emulator

2011-11-09 Thread Mark Ellul
As far as I have ascertained, this issue is not an Android issue, it has to 
do with the Sim and access to the Sim given to Android by the provider.

So basically, if you get a Null its because the phone doesn't know its own 
phone number, and you have to ask the user, or does some work around, like 
a lost call to a know number using an suffix to identify the phone/user. 

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

Re: [android-developers] Re: Cannot get PhoneNumber on Real device but code works in Emulator

2010-03-10 Thread Zeeshan Muhammad
I am also having the same problem.
 String MSISDN  = ((TelephonyManager)
this.getSystemService(this.TELEPHONY_SERVICE)).getLine1Number();

returns null.

is there any way i can get MSISDN?
can i get it by sms?



On Wed, Sep 23, 2009 at 6:15 AM, an0 an0...@gmail.com wrote:


 I've the same problem. In what cases will getLine1Number return null
 or empty? And what to do to fetch the phone number in these cases?

 On Sep 8, 1:42 pm, Roman ( T-Mobile USA) roman.baumgaert...@t-
 mobile.com wrote:
  Your code looks fine to me.
 
  Could you check whether this.telMgr.getLine1Number() returns null ?
 
  Also verify the setting application (go to about phone -- status --
  phone number). You should be able to see your phone number.
 
  In cases where you have the radio switched off you cannot read the
  phone number from your SIM card or the SIM card is not available at
  all.
 
  By the way from which carrier is your SIM card?
 
  --
  Roman Baumgaertner
  Sr. SW Engineer-OSDC
  ·T· · ·Mobile· stick together
  The views, opinions and statements in this email are those of the
  author solely in their individual capacity, and do not necessarily
  represent those of T-Mobile USA, Inc.
 
  On Sep 7, 9:48 am, Mark Ellul mark.el...@gmail.com wrote:
 
 
 
   Hi,
 
   I am trying to create an app that gets the location and telephone
   number of the phone.
 
   This is the Code I am using to get the telephone number (I am focusing
   on sdk 1.5) and in the emulator this works
 
   try {
   this.telMgr = (TelephonyManager) this.getSystemService
   (Context.TELEPHONY_SERVICE);
   this.telephoneNumber = this.telMgr.getLine1Number();
   LogMessage(String.format(Your Telephone Number:%s,
   this.telephoneNumber));
   } catch(Exception ex)
   {
   LogMessage(ex.getMessage());
   }
 
   However on my HTC Hero it doesn't.
 
   The Permissions I am using for both Location and Telephone number
   are...
 
   uses-permission
   android:name=android.permission.ACCESS_FINE_LOCATION/uses-
   permission
   uses-permission
   android:name=android.permission.ACCESS_MOCK_LOCATION/uses-
   permission
   uses-permission android:name=android.permission.CALL_PHONE/uses-
   permission
   uses-permission
   android:name=android.permission.ACCESS_COARSE_LOCATION/uses-
   permission
 
   uses-permission android:name=android.permission.READ_PHONE_STATE/
   uses-permission
   uses-permission
   android:name=android.permission.PROCESS_OUTGOING_CALLS/uses-
   permission
 
   Can anyone help me out with some pointers on where to start looking?
 
   Regards
 
   Mark
 --~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Cannot get PhoneNumber on Real device but code works in Emulator

2009-09-08 Thread Mark Ellul

Hi Roman,

Thanks for your Response!

I am using a HTC Hero in Spain, using Yoigo Network.

I checked the settings and the Voice MSISDN Line1 number is indeed
unknown, so I guess thats why I am receiving a null value for the
phone number.

I will be testing with a US Sim (as soon as I received it) and will
add to this thread.

Regards

Mark

On Sep 8, 7:42 am, Roman ( T-Mobile USA) roman.baumgaert...@t-
mobile.com wrote:
 Your code looks fine to me.

 Could you check whether this.telMgr.getLine1Number() returns null ?

 Also verify the setting application (go to about phone -- status --
 phone number). You should be able to see your phone number.

 In cases where you have the radio switched off you cannot read the
 phone number from your SIM card or the SIM card is not available at
 all.

 By the way from which carrier is your SIM card?

 --
 Roman Baumgaertner
 Sr. SW Engineer-OSDC
 ·T· · ·Mobile· stick together
 The views, opinions and statements in this email are those of the
 author solely in their individual capacity, and do not necessarily
 represent those of T-Mobile USA, Inc.

 On Sep 7, 9:48 am, Mark Ellul mark.el...@gmail.com wrote:



  Hi,

  I am trying to create an app that gets the location and telephone
  number of the phone.

  This is the Code I am using to get the telephone number (I am focusing
  on sdk 1.5) and in the emulator this works

  try {
              this.telMgr = (TelephonyManager) this.getSystemService
  (Context.TELEPHONY_SERVICE);
              this.telephoneNumber = this.telMgr.getLine1Number();
              LogMessage(String.format(Your Telephone Number:%s,
  this.telephoneNumber));
              } catch(Exception ex)
              {
                  LogMessage(ex.getMessage());
              }

  However on my HTC Hero it doesn't.

  The Permissions I am using for both Location and Telephone number
  are...

      uses-permission
  android:name=android.permission.ACCESS_FINE_LOCATION/uses-
  permission
  uses-permission
  android:name=android.permission.ACCESS_MOCK_LOCATION/uses-
  permission
  uses-permission android:name=android.permission.CALL_PHONE/uses-
  permission
  uses-permission
  android:name=android.permission.ACCESS_COARSE_LOCATION/uses-
  permission

  uses-permission android:name=android.permission.READ_PHONE_STATE/
  uses-permission
  uses-permission
  android:name=android.permission.PROCESS_OUTGOING_CALLS/uses-
  permission

  Can anyone help me out with some pointers on where to start looking?

  Regards

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



[android-developers] Re: Cannot get PhoneNumber on Real device but code works in Emulator

2009-09-07 Thread Roman ( T-Mobile USA)

Your code looks fine to me.

Could you check whether this.telMgr.getLine1Number() returns null ?

Also verify the setting application (go to about phone -- status --
phone number). You should be able to see your phone number.

In cases where you have the radio switched off you cannot read the
phone number from your SIM card or the SIM card is not available at
all.

By the way from which carrier is your SIM card?

--
Roman Baumgaertner
Sr. SW Engineer-OSDC
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.

On Sep 7, 9:48 am, Mark Ellul mark.el...@gmail.com wrote:
 Hi,

 I am trying to create an app that gets the location and telephone
 number of the phone.

 This is the Code I am using to get the telephone number (I am focusing
 on sdk 1.5) and in the emulator this works

 try {
             this.telMgr = (TelephonyManager) this.getSystemService
 (Context.TELEPHONY_SERVICE);
             this.telephoneNumber = this.telMgr.getLine1Number();
             LogMessage(String.format(Your Telephone Number:%s,
 this.telephoneNumber));
             } catch(Exception ex)
             {
                 LogMessage(ex.getMessage());
             }

 However on my HTC Hero it doesn't.

 The Permissions I am using for both Location and Telephone number
 are...

     uses-permission
 android:name=android.permission.ACCESS_FINE_LOCATION/uses-
 permission
 uses-permission
 android:name=android.permission.ACCESS_MOCK_LOCATION/uses-
 permission
 uses-permission android:name=android.permission.CALL_PHONE/uses-
 permission
 uses-permission
 android:name=android.permission.ACCESS_COARSE_LOCATION/uses-
 permission

 uses-permission android:name=android.permission.READ_PHONE_STATE/
 uses-permission
 uses-permission
 android:name=android.permission.PROCESS_OUTGOING_CALLS/uses-
 permission

 Can anyone help me out with some pointers on where to start looking?

 Regards

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