none
Retrieving the SIM number RRS feed

  • Question

  •  

    I am trying to retrieve the SIM number of my Smartphone using SystemStatus.OwnerPhoneNumber(). But it only returns a value if the number is set manually in the device.

    can anybody please tell me how to retrieve the SIM number without having to set in the device?

    Wednesday, May 14, 2008 7:20 AM

Answers

  • If you only need a 'unique' number from the device - I'd strogly suggest you're using the GetDeviceUniqueID API. See the following blog for details: http://blogs.msdn.com/windowsmobile/archive/2006/01/09/510997.aspx

     

    If you really need the IMSI number, you'l find the answer here: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1431987&SiteID=1

     

    Just be aware that reading the IMSI number uses privileged APIs. So depending on the device's security configuration you may have to sign your application with a privileged certificate.

    Thursday, May 15, 2008 7:23 PM
    Moderator
  • Hi Graham

     

    The SIM card has a place to store the phone number (MSISDN). This number may be present on a SIM - but does not have to.

    The phone number is not unique to a SIM card. Some operator offer services/contract where you can have two SIM cards using the same phone number. Same if you loose your phone and get a replacement SIM -> you get the same phone number.

     

    A GSM device does not need the 'phone number' to talk to the GSM network. It'll use the IMSI (International Mobile Subscriber Identity) number which is stored on the SIM card as well.

     

    The only thing that's guaranteed to be there on a SIM card is the IMSI number. If you need to uniquely identify a SIM card this is the way to go.

     

    Hope this helps to clarify

    Michael

     

     

     

     

    Tuesday, May 20, 2008 12:31 PM
    Moderator

All replies

  • hi.there is a ready made application for getting the sim number in the windows mobile sdk.But the readme text along with the sample code says that it may not work with some devices.Does not work with mine(htc s710).but you can try.go to windows mobile sdk in program files and check out the samples.hope it helps.probably it is in

    Folder : \Common\CPP\Win32\GetPhoneNumber

    Wednesday, May 14, 2008 2:32 PM
  • I have already tried this but it doesn't work. I keep getting the same result even when I remove the SIM.

    Any other suggestion?

     

    Thursday, May 15, 2008 5:05 AM
  • A GSM device does not need know its own phone number (MSISDN). The phone only uses its IMSI (International Mobile Subscriber Identity) number to talk to the network. An explanation why can be found here.

     

    So the only option you have is to store the number in the SIM card.

     

     

    Thursday, May 15, 2008 9:17 AM
    Moderator
  • Thanks a lot Michael! I have read the explanation. I can make do with the IMSI.

     

    But I still face the problem of how to obtain the IMSI. I haven't been able to locate a function for this.

    Thursday, May 15, 2008 1:10 PM
  • If you only need a 'unique' number from the device - I'd strogly suggest you're using the GetDeviceUniqueID API. See the following blog for details: http://blogs.msdn.com/windowsmobile/archive/2006/01/09/510997.aspx

     

    If you really need the IMSI number, you'l find the answer here: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1431987&SiteID=1

     

    Just be aware that reading the IMSI number uses privileged APIs. So depending on the device's security configuration you may have to sign your application with a privileged certificate.

    Thursday, May 15, 2008 7:23 PM
    Moderator
  • Thanks Michael, I was able to retrieve the DeviceID. But I am still blank where the IMSI is concerned.

     

    The link for searching the IMSI was not much help. Could you tell me more?

    Friday, May 16, 2008 10:20 AM
  • Concerning the IMSI question: what exactly are you looking for?

    I just came accross a sample here. This might be what you're looking for.

    Friday, May 16, 2008 4:17 PM
    Moderator
  • Hi,

    just found this thread and it is also basically what I want to do.

    I'm confused though - the phone number is not stored on the sim?

     

    MS says here http://msdn.microsoft.com/en-us/library/ms839358.aspx

    "The SIM card holds the phone number of the mobile phone and identity of the operator who provided it."

     

    If I change the sim in my phone and call my number, nothing happens.

     

    Equally. if I put my wife's card in my phone and make a call, her account is debited, not mine.

     

    So, how does this happen?

    Where is the phone number stored ?

     

    I really need an ID that is unique to a simcard and thought that the phone number might do the trick.

     

    cheers,

    Graham

     

    Tuesday, May 20, 2008 11:42 AM
  • Hi Graham

     

    The SIM card has a place to store the phone number (MSISDN). This number may be present on a SIM - but does not have to.

    The phone number is not unique to a SIM card. Some operator offer services/contract where you can have two SIM cards using the same phone number. Same if you loose your phone and get a replacement SIM -> you get the same phone number.

     

    A GSM device does not need the 'phone number' to talk to the GSM network. It'll use the IMSI (International Mobile Subscriber Identity) number which is stored on the SIM card as well.

     

    The only thing that's guaranteed to be there on a SIM card is the IMSI number. If you need to uniquely identify a SIM card this is the way to go.

     

    Hope this helps to clarify

    Michael

     

     

     

     

    Tuesday, May 20, 2008 12:31 PM
    Moderator
  • I tried the sample code from the SDK to get the SIM card number. It only works on the emulator and returns a US number. On other phones I tried, it returns blank or fail with HRESULT < 0.

    Tuesday, May 20, 2008 2:27 PM
  • Thanks Michael.

    What made it more confusing is that I was reading IMSI and thinking IMEI !!

     

    Tuesday, May 20, 2008 6:53 PM
  • will it be a simple add contact in the SIM. or there should a special format to save.

    In my case, client can save their own number in SIM but i need to get the number through TAPI. 
    Sunday, February 22, 2009 10:51 AM
  • Hi,

    This might be of some use, it will get the number printed on the SIM Card :-

    http://blog.opennetcf.com/ncowburn/CommentView,guid,309b8b8e-ebc7-4078-a8ba-f174761ea7af.aspx

    Hope this helps.

    Paul
    http://www.smartmobiledevice.co.uk/
    Tuesday, February 24, 2009 11:57 AM
  • SystemStatus dose not exit current context

    Thursday, June 6, 2019 12:38 PM