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

Your email address will not be published. Required fields are marked *

You May Also Like

In this post, you’ll learn about the Win32 Error “0x000019E5 – ERROR_COULD_NOT_RESIZE_LOG” that you get when debugging system erors in...
In this post, you’ll learn about the error “CO_E_DBERROR 0x8004E02B” that is returned when working with COM based APIs or...
In this post, you’ll learn about the Win32 Error “0x000019D0 – ERROR_LOG_BLOCK_VERSION” that you get when debugging system erors in...