1

Ti.getPlatform() this method gives me the platform name, eg: osx or win32

In my case, I want to show the current version of windows .How can I get the Windows Version using tideSDK?

eg: Win7 or Win8

2 Answers2

1

After attempting to do this myself, I've concluded: yes and no. What you can do is use Ti.Platform.getVersion(), which will return something like:

6.1 (Build 7601: Service Pack 1)

What this number indicates is a Windows NT version and build number (Windows NT is returned universailly for Ti.Platform.getName(), as it's the basic version of Windows used since Windows 3.1). This data can then be cross-referenced by your application to this table to determine which version is being run.

For the above-returned information, 6.1 is enough to tell you that my machine is running Windows 7. A Windows 8 machine will use 6.2, while a computer running the recently-released Windows 8.1 update will report 6.3.

So no, as far as I can tell, there is no function that will spit out Windows 7 or Windows 8: but yes, it is possible, with a little code, to determine the version yourself.

Meshaal
  • 694
  • 2
  • 7
  • 18
1

I have used following helper on tideSDK to get the OSNAME out, as I needed both windows and MAC Names.

   function findOSVersion(){
      var OSName = "Unknown";
      if (window.navigator.userAgent.indexOf("Windows NT 6.2") != -1) OSName="WIN8";
      if (window.navigator.userAgent.indexOf("Windows NT 6.1") != -1) OSName="WIN7";
      if (window.navigator.userAgent.indexOf("Windows NT 6.0") != -1) OSName="Windows Vista";
      if (window.navigator.userAgent.indexOf("Windows NT 5.1") != -1) OSName="WinXP";
      if (window.navigator.userAgent.indexOf("Windows NT 5.0") != -1) OSName="Windows 2000";
      if (window.navigator.userAgent.indexOf("Mac")!=-1) OSName="MAC";
      if (window.navigator.userAgent.indexOf("X11")!=-1) OSName="UNIX";
      if (window.navigator.userAgent.indexOf("Linux")!=-1) OSName="Linux";
      return OSName
    }