Tuesday, 4 June 2013

How to get DeviseId in Windows Phone usig c# code and convert to base64 string

How to get DeviseId in Windows Phone usig c# code and convert to base64 string



Step 1 : First create your windows phone application it's may be 7.0,7.1,8.0 application.

Step2: Open MainPage.xaml code file and paste below code in your file

using Microsoft.Phone.Info;

private string m_DeviceUniqueId;
        public string DeviceId
        {
            get
            {
                if (m_DeviceUniqueId == null)
                {
                    object val;
                    if (Microsoft.Phone.Info.DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out val))
                        m_DeviceUniqueId = Convert.ToBase64String((val as byte[]));
                }
                return m_DeviceUniqueId;
            }
        }

Step 3 : Call DeviseID function and get the Windows Phone Devise Id


Step 4 : This way you can get  deviseId information using c# code and Info class.



No comments:

Post a Comment

Thank you for your interest .