[Solved] Getting My Phone Number

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

[Solved] Getting My Phone Number

Postby felix » Thu Mar 27, 2008 10:11 pm

I'm need to get my phone number, have any mode to take this? in run time?

thanks for help
Last edited by felix on Fri Mar 28, 2008 5:17 pm, edited 1 time in total.
felix
Junior Developer
Junior Developer
 
Posts: 18
Joined: Thu Feb 14, 2008 4:25 pm
Location: Brasil

Top

Phone number

Postby cadlg » Thu Mar 27, 2008 10:23 pm

Hi Felix,
I have not tested it, but the android.telephony.TelephonyProperties interface should do the job.

The documentation says that you can use os.SystemProperties to get and set the various properties on this interface.

something like this:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. myPhoneNumber = android.os.SystemProperties.get( android.telephony.TelephonyProperties.PROPERTY_LINE1_NUMBER);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

Regards,

cadlg
cadlg
Experienced Developer
Experienced Developer
 
Posts: 84
Joined: Wed Feb 20, 2008 12:33 am
Location: Guatemala

Postby felix » Thu Mar 27, 2008 10:51 pm

It's returns a Empty String.

But in de javadoc says to configure the Sim to "ready", how to configure them?

thanks for your help.
felix
Junior Developer
Junior Developer
 
Posts: 18
Joined: Thu Feb 14, 2008 4:25 pm
Location: Brasil

tested

Postby cadlg » Thu Mar 27, 2008 11:08 pm

Hi Felix, I have just tested, and it works for me.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. mScreen.setText(android.os.SystemProperties.get( android.telephony.TelephonyProperties.PROPERTY_LINE1_NUMBER));
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

it returns 15555218135

I did not make any sim configuration.

cadlg
cadlg
Experienced Developer
Experienced Developer
 
Posts: 84
Joined: Wed Feb 20, 2008 12:33 am
Location: Guatemala

Postby cadlg » Thu Mar 27, 2008 11:11 pm

You could try setting the PROPERTY_SIM_STATE property (using the same method), to the "READY" state.

Regards,

cadlg
cadlg
Experienced Developer
Experienced Developer
 
Posts: 84
Joined: Wed Feb 20, 2008 12:33 am
Location: Guatemala

Postby felix » Fri Mar 28, 2008 5:17 pm

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. android.os.SystemProperties.get( android.telephony.TelephonyProperties.PROPERTY_LINE1_NUMBER)
  3.  
  4.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4

it's works

I'm trying to get the number using :

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.  
  3.  
  4. SystemProperties.get( TelephonyProperties.PROPERTY_LINE1_NUMBER);
  5.  
  6.  
  7.  
  8.  
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


Well it's done, thanks for your help
felix
Junior Developer
Junior Developer
 
Posts: 18
Joined: Thu Feb 14, 2008 4:25 pm
Location: Brasil

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 43 guests