Reputation: 1640
On a window mobile 6 phone I need to retrieve the phone number of the SIM card in the device. I can manually dial *#100# and the phone number appears on the screen.
Does anybody know how to do this programmatically?
Preferably in C# but C++ will do, I can translate.
SystemState.OwnerNumber
just returns an empty string (probably relies on the number being stored in the SIM correctly) but *#100# works.
Upvotes: 1
Views: 1041
Reputation: 1070
A way to get the number on the sim card of a phone is to send an sms to some number which some server is listening on. The sms will carry along the phone number of the sender. Once your server receives the sms, the server can then send a push message to your client application with the phone number the client needs. Hope this helps.
Upvotes: 0
Reputation: 1814
The phone number isn't actually stored on the SIM card but in a mobile network database called HLR. There the user friendly phone number is matched with a subscription id called IMSI which is physically stored on your SIM card.
So in order to retrieve the phone number your application must be allowed by the device to communicate on the network.
Upvotes: 2