HomeWindowsOxygene and WP8 – How to get the Unique Device ID in Windows Phone using Oxygene?

Oxygene and WP8 – How to get the Unique Device ID in Windows Phone using Oxygene?

Oxygene and Windows Phone 8 tutorials – Article Index

In Windows Phone 8, you can easily get the Unique Device ID using the DeviceExtendedProperties.GetValue or DeviceExtendedProperties.TryGetValue method.

In order to retrieve the Unique Device ID in Windows Phone, the developer should also include the ID_CAP_IDENTITY_DEVICE capability in the WMAppManifest.xml file.

When this is not included, you will receive the following message when trying to executing the code.

“An exception of type ‘System.UnauthorizedAccessException’ occurred in Microsoft.Phone.ni.dll but was not handled in user code”

Oxygene and WP8 - How to get the Unique Device ID in Windows Phone using Oxygene?

How to get the Unique Device ID in Windows Phone using Oxygene?

The DeviceExtendedProperties.GetValue returns the byte array which in turn can be converted to base64 string to retrieve the unique device id.

var DeviceID: array of System.Byte := array of System.Byte(Microsoft.Phone.Info.DeviceExtendedProperties.GetValue('DeviceUniqueId'));

var UniqueDeviceID: System.String := Convert.ToBase64String(DeviceID);

MessageBox.Show(UniqueDeviceID);

Oxygene and WP8 - How to get the Unique Device ID in Windows Phone using Oxygene?

 

Share:

Leave a Reply

You May Also Like

This blog post will guide you through several effective methods to troubleshoot and resolve the issue of Microsoft Edge not...
Windows 11 offers a range of audio enhancements that can enrich your listening experience. These enhancements include features like virtual...
Windows 11 brings a fresh and visually stunning design to your desktop, and one of the standout features is the...