Skip to main content
February 27, 2012
Answered

How do I get the platform on which my application is executed?

  • February 27, 2012
  • 3 replies
  • 807 views

I need to determine on which platform (iOS or Android) my application is currently executed. Is there a way to do this? Until now I just found the Capabilities.os property which is I think for exactly this case. The problem with that property is, that it only return the different Windows version, or if the platform is a Mac or Linux or iPhone OS (is that iOS? I don't know...).

Are there any ideas how I could solve this?

This topic has been closed for replies.
Correct answer Colin Holgate

Code that I've seen online suggests that "ios" is in the version, so doing this ought to work:

if (Capabilities.version.indexOf('IOS') < 0) {

3 replies

Participating Frequently
February 28, 2012

Also, you can check the Capabilities.manufacturer flag, which contains Android Linux, Apple iOS etc.

February 28, 2012

Thanks guys,

the solution of Colin Holgate works for me, although it should be

if (Capabilities.version.indexOf('IOS') >= 0) 

if i want to check if my application runs on iOS. If I want to check for Android I use, of course, AND instead of IOS.

Colin Holgate
Colin HolgateCorrect answer
Inspiring
February 27, 2012

Code that I've seen online suggests that "ios" is in the version, so doing this ought to work:

if (Capabilities.version.indexOf('IOS') < 0) {

Inspiring
February 27, 2012

I believe the code you have listed would be executed if the platform is NOT iOS.

I would suggest using the following and comparing to "AND", "IOS", "WIN", "LIN", and "MAC".

flash.system.Capabilities.version.substr(0,3).toUpperCase();