MSDOTnet.org Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Simply obtaining the Mobile Phone Number of the User

 
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> Compact Framework
Author Message
sauly



Joined: 27 Feb 2008
Posts: 1

PostPosted: Wed Feb 27, 2008 2:36 am    Post subject: Simply obtaining the Mobile Phone Number of the User Reply with quote

Hello all,

I have written an application used by a large number of remote sales
staff. When they sync their daily data, I want to know what phone
number (SIM) they have in their smartphone. I have already used the
TAPI to find the IMEI of the device.

There seems to be quite a lot of information about how to find the
phone number of the caller when a call comes in, but I'm just trying
to find the phone number of the device itself. In other words, what
you see in Start Menu : Settings : Personal (tab) : Phone : "Phone
Number". Or, to put it a third way, if it was my mobile phone, what my
own mobile phone number was.

The application is written for an XDA II device, PocketPC version 4.2.
In Visual Basic, compact framework.

Any help appreciated! Thanks a lot in advance, as this is driving me
nuts.

Regards,
Saul

Archived from group: microsoft>public>dotnet>framework>compactframework
Back to top
View user's profile Send private message
Bjorn Brox



Joined: 13 Feb 2008
Posts: 1

PostPosted: Wed Feb 27, 2008 1:48 pm    Post subject: Re: Simply obtaining the Mobile Phone Number of the User Reply with quote

sauly skrev:
> Hello all,
>
> I have written an application used by a large number of remote sales
> staff. When they sync their daily data, I want to know what phone
> number (SIM) they have in their smartphone. I have already used the
> TAPI to find the IMEI of the device.
>
> There seems to be quite a lot of information about how to find the
> phone number of the caller when a call comes in, but I'm just trying
> to find the phone number of the device itself. In other words, what
> you see in Start Menu : Settings : Personal (tab) : Phone : "Phone
> Number". Or, to put it a third way, if it was my mobile phone, what my
> own mobile phone number was.
>
> The application is written for an XDA II device, PocketPC version 4.2.
> In Visual Basic, compact framework.
>
> Any help appreciated! Thanks a lot in advance, as this is driving me
> nuts.
>
To get the telephone number as written in your "setting, personal,
Phone" is easy, but you don't have any guarantee that it is the real
phone number since thus user can type anything in that field.

Your only real ID you can trust for the phone is the IMEI.


C#
String phone_number = SystemState.OwnerPhoneNumber.

or
String phone_number =
SystemState.GetValue(SystemProperty.OwnerPhoneNumber).ToString();

--
Bjorn Brox
Back to top
View user's profile Send private message
saulysw



Joined: 27 Feb 2008
Posts: 2

PostPosted: Wed Feb 27, 2008 7:02 pm    Post subject: Re: Simply obtaining the Mobile Phone Number of the User Reply with quote

Bjorn,

Thank you very much for your reply.

Sadly, it doesn't work for me as I am using Windows Mobile 2003, and
the SystemState class is only in Windows Mobile 6. It is exactly what
I am looking for though - something as simple as this....

Regards,
Saul
Back to top
View user's profile Send private message
Christian Resma Helle



Joined: 08 Aug 2007
Posts: 50

PostPosted: Thu Feb 28, 2008 5:30 am    Post subject: Re: Simply obtaining the Mobile Phone Number of the User Reply with quote

There was an old article on PocketPCDN on how to do this in native code:
http://www.pocketpcdn.com/articles/ownerinformation.html

Here's the managed version of it:

-----------------------------------------------------------------------------------
string owner_phone;

RegistryKey key = Registry.CurrentUser.OpenSubKey(@"\ControlPanel\Owner");
if (key != null) {
byte[] value = key.GetValue("Owner", null) as byte[];
if (value != null) {
owner_phone = Encoding.Unicode.GetString(value, 0x204, 50);
int index = owner_phone.IndexOf('\0');
if (index != -1) {
owner_phone = owner_phone.Substring(0, index);
}
}
key.Close();
}

MessageBox.Show(owner_phone, "Owner Phone");
-----------------------------------------------------------------------------------

--
Regards,
Christian Resma Helle
http://christian-helle.blogspot.com


wrote in message @s12g2000prg.googlegroups.com...
> Bjorn,
>
> Thank you very much for your reply.
>
> Sadly, it doesn't work for me as I am using Windows Mobile 2003, and
> the SystemState class is only in Windows Mobile 6. It is exactly what
> I am looking for though - something as simple as this....
>
> Regards,
> Saul
Back to top
View user's profile Send private message
saulysw



Joined: 27 Feb 2008
Posts: 2

PostPosted: Wed Feb 27, 2008 9:43 pm    Post subject: Re: Simply obtaining the Mobile Phone Number of the User Reply with quote

Christian,

Thank you for your suggestion. You are both ledgends in my books for
doing this!

Unfortunately, your solution is also not really that good for me,
although I can use your code. The issue is that the Owner section is
user-configurable, and I know they have not put that info in the
"Phone number" field, and even if they have, I can't trust it. People
swap SIM cards on me. What I really want is to be able to query the
SIM card and find out what phone number it really has. The machine
*does* know what it's own number is, without user input, as it's in
the Start Menu : Settings : Personal (tab) : Phone : "Phone Number"
field. This is not the same as the Owner information area, and it is
not changable by the user (ie its a label field, not input textbox).

I really appreciate the time/effort you guys have given for this, but
I am still looking for a solution.

Regards,
Saul
Back to top
View user's profile Send private message
user



Joined: 08 Aug 2007
Posts: 286

PostPosted: Thu Feb 28, 2008 1:31 am    Post subject: Re: Simply obtaining the Mobile Phone Number of the User Reply with quote

If you want the actual number, it's available through TAPI. TAPI, however,
is far from fun or easy to use in native code and it's much worse in managed
code. OpenNETCF has a Telephony library that wraps TAPI for managed code,
but it's not free. There are some reasonable online resources and
documentation for TAPI and if you've got time and a bit of P/Invoke skill,
it can be resolved.


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com


wrote in message @41g2000hsc.googlegroups.com...
> Christian,
>
> Thank you for your suggestion. You are both ledgends in my books for
> doing this!
>
> Unfortunately, your solution is also not really that good for me,
> although I can use your code. The issue is that the Owner section is
> user-configurable, and I know they have not put that info in the
> "Phone number" field, and even if they have, I can't trust it. People
> swap SIM cards on me. What I really want is to be able to query the
> SIM card and find out what phone number it really has. The machine
> *does* know what it's own number is, without user input, as it's in
> the Start Menu : Settings : Personal (tab) : Phone : "Phone Number"
> field. This is not the same as the Owner information area, and it is
> not changable by the user (ie its a label field, not input textbox).
>
> I really appreciate the time/effort you guys have given for this, but
> I am still looking for a solution.
>
> Regards,
> Saul
>

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
Which Visual Studio for Win Mobile 5 development? Which Visual Studio can handle Win Mobile 5 development? I have the SDK on a DVD, but I need to know which VS 2005 to install to fully handle the development process? The only two people I know that are developing are using the Enterprise editions, but

Can Windows Mobile 2003 SDK be installed on Visual C# .NET S Hi, Can Windows Mobile 2003 SDK be installed on Visual C# .NET Standard Version 2003? Dunster

Having Trouble Displaying a User created control I have created a control that takes the Battery control from Open NETCF (which is excellent) and then adds some extra functionality that we need in our enviroment. The extras are 802.11b signal strength and quality and also a control that will allow the u

How to get the WAP visitor's mobile phone number ?- Urgent Hi, all I have a very difficult question, I want to record the visitor's mobile phone number ,but how I can get the WAP visitors's mobile phone number? Any helpful ideas would be highly appreciated! -ja

Guidance on uploading an image from a mobile device or phone I am researching uploading an image from a mobile device or cell phone, such as a user takes a picture with his/her cell phone, then uploads it to a web site. Can anyone give some direction on where to read about this, suggestions on where start, etc? I c
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> Compact Framework All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group