Reputation: 266
I am working on an app that will obtain an X.509 certificate for a device that will be used to encrypt various configuration data. Ideally, this certificate would contain information that can be correlated with procurement records. Is there any way to read the device serial number or IMEI from a universal windows app?
Upvotes: 4
Views: 3163
Reputation: 17668
As for UWP in general, to get a system unique id (not IMEI), you might want to check out these classes:
Windows.System.Profile.SystemIdentification
and
Windows.System.Profile.HardwareIdentification
E.g.: you can query a unique device id with:
var buffer = SystemIdentification.GetSystemIdForPublisher();
Which has the following remarks according to msdn:
The ID has the following characteristics:
- Unique for every system
- Can be created offline
- Persists across rebooting, OS upgrades/reinstalls, and so on
- Persists across hardware modifications
- Available in OneCore
- Available on the factory floor for licensing purposes
Be aware that the return type is an IBuffer
and produces some raw (non-string-like-readable) bytes so you might need to serialize that.
More info
and
Upvotes: 6
Reputation: 38833
It is not possible to get IMEI of another phone with phone number information, however you can get the device unique Id.
using Microsoft.Phone.Info;
object uniqueId;
var hexString = string.Empty;
if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueId))
hexString = BitConverter.ToString((byte[])uniqueId).Replace("-", string.Empty);
MessageBox.Show("myDeviceID:" + hexString);
Upvotes: 1