locked
IMEI Number on Windows Mobile RRS feed

  • Question

  • How do i get an IMEI number on windows Mobile? The code below is not working:

    public static string GetIMEI()
            {
                string sIMEI = null;
                OpenNETCF.Tapi.Tapi t = new OpenNETCF.Tapi.Tapi();
                t.Initialize();
                OpenNETCF.Tapi.Line l = t.CreateLine(0, OpenNETCF.Tapi.LINEMEDIAMODE.INTERACTIVEVOICE, OpenNETCF.Tapi.LINECALLPRIVILEGE.MONITOR);
                byte[] buffer = new byte[513];
                //write size
                BitConverter.GetBytes(512).CopyTo(buffer, 0);
                if (CellTSP.lineGetGeneralInfo(l.hLine, buffer) != 0)
                {
                    throw new System.ComponentModel.Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error(), "TAPI Error: " + System.Runtime.InteropServices.Marshal.GetLastWin32Error().ToString("X"));
                }
                int serialsize = BitConverter.ToInt32(buffer, 36);
                int serialoffset = BitConverter.ToInt32(buffer, 40);
                sIMEI = System.Text.Encoding.Unicode.GetString(buffer, serialoffset, serialsize);
                sIMEI = sIMEI.Substring(0, sIMEI.IndexOf(""));
                l.Dispose();
                t.Shutdown();
                return sIMEI;
            }
    • Moved by SamAgain Monday, March 8, 2010 3:55 AM better fit (From:.NET Base Class Library)
    Friday, March 5, 2010 7:11 AM

Answers

All replies

  • Hi, Makhosa:
         Thanks for your posting.  There is a dedicated forum for topics like yours and I am moving your thread there for better & quicker response.


    Please mark the right answer at right time.
    Thanks,
    Sam
    Monday, March 8, 2010 3:51 AM
  • Please read the following article for how to get the IMEI number with OpenNETCF's TAPI wrapper:
    HOWTO: Retrieve the IMEI and IMSI of a device  

    Here is another sample without using OpenNETCF Telephony API:
    Retrieve IMEI Through TAPI 
    Please mark the post that helps you, and unmark that does not. This benefits our community.
    • Marked as answer by warrentang Thursday, March 11, 2010 3:01 AM
    Tuesday, March 9, 2010 7:56 AM