OS detection

edited July 7 in Android Mode

Is it possible to use something like this?

void setup(){ if (OS == "Android"){ fullScreen(); } else size(400, 400); } ...

Tagged:

Answers

  • Answer ✓

    there is a separate mode for Android so i dont think there is a need for that. and your android code not work in any other OS(if I am right)

  • Answer ✓

    Code done in Processing can run in java mode or Android mode only if not using an external library that is OS dependent. However, keep in mind that for Android, you are actually exporting the application every time you run it.

    If your feature is only needed to change the initial screen size, then I will just change those values manually. Would you need this feature for anything else?

    Kf

  • edited July 8

    No, just for this screen sizing situation kfrajer.. I have a habit of using this "type of configuration" in Unity3D (from Windows for Android and vice versa), I thought there was something similar in Processing .., thanks for the help guys!

  • edited July 8

    I think there's something in processing that knows, but i cant find it. There definitely is a Java system property that will tell you.

    String OS = System.getProperty("os.name").toLowerCase(); 
    
  • Apparently android reports itself as Linux, so that night not help.

    http://srdevspot.blogspot.co.uk/2014/09/java-systemgetproperties-on-various_12.html

Sign In or Register to comment.