0

I'm a beginner of Angular2. I am trying to write a application in Angular2. Now I can use navigator.userAgent to detect browser name.

If the user use Chrome on windows. the data is like {'browser':'Chrome'}

If the user use Safari on iphone, the data is like {'browser':'Safari'}

If the user use Firefox on Android, the data is like {'browser':'Firefox'}

 public static DeviceDetector():string {
    let ua:string = navigator.userAgent;
    let browser:string;
    if (ua.indexOf("Chrome") > -1) {
      browser = "Google Chrome";
    } else if (ua.indexOf("Safari") > -1) {
      browser = "Apple Safari";
    } else if (ua.indexOf("Opera") > -1) {
      browser = "Opera";
    } else if (ua.indexOf("Firefox") > -1) {
      browser = "Mozilla Firefox";
    } else if (ua.indexOf("MSIE") > -1) {
      browser = "Microsoft Internet Explorer";
    }
    return browser;
  }

Just want to know How to get current device UUID in Angular2? Because The API I am trying to call that require device ID and name. I checked the code of the existing windows mobile client and found a function called Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation()

public static string GetDeviceName(out string strDeviceID, out string strDeviceName)
        {
            strDeviceID = "";
            strDeviceName = "";

            var deviceInfo = new Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation();

            if (deviceInfo == null)
                return "We are unable to sign you into server as you device name cannot be determined. Please try rebooting your device and trying again.";

            strDeviceID = deviceInfo.Id.ToString();
            strDeviceName = deviceInfo.FriendlyName;

            return "";
        }

I need write something like windows mobile client in Angular2. Is it possible to get the device ID like this?

ClydeShen
  • 11
  • 3

0 Answers0