c# - How do I get a Unique Identifier for a Raspberry PI within Windows 10 IoT Core (Creators Update) -
i tried method (found on https://stackoverflow.com/a/31803247/2427812) on windows 10 iot core [version 10.0.15063] (raspberry pi 3) hardwareid result of getid() changes every time device restarts.
have idea why should happen?
private static string getid() { if (windows.foundation.metadata.apiinformation.istypepresent("windows.system.profile.hardwareidentification")) { var token = hardwareidentification.getpackagespecifictoken(null); var hardwareid = token.id; var datareader = windows.storage.streams.datareader.frombuffer(hardwareid); byte[] bytes = new byte[hardwareid.length]; datareader.readbytes(bytes); return bitconverter.tostring(bytes).replace("-", ""); } throw new exception("no api device id present!"); }
Comments
Post a Comment