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 will learn about sync provider notifications in Windows 11 and how to disable or enable it...
In this tutorial, let’s learn how to enable or disable the startup sound in Windows 11. By default, when Windows...
In this post, you’ll learn about the Win32 Error “0x0000083B – NERR_DevNotRedirected” that you get when debugging system erors in...