1
votes

I'm trying to get the device_id in Windows Phone 8. I tried doing this:

byte[] myDeviceID = (byte[])Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceUniqueId");
string DeviceIDAsString = Convert.ToBase64String(myDeviceID);

and this:

DeviceExtendedProperties.GetValue("DeviceUniqueId").ToString();

Both resulted in the following exception:

An exception of type 'System.UnauthorizedAccessException' occurred in Microsoft.Phone.ni.dll but was not handled in user code

Additional information: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

How can I solve this issue?

2

2 Answers

6
votes

You need to add required capabilities in your App manifest file. Particularly, try to add this capability :

ID_CAP_IDENTITY_DEVICE

For reference :

1
votes

I think You must have forgot to add Capability. ID_CAP_IDENTITY_DEVICE should be checked in WMAppMenifest.xml