I have an app that runs on several mobile devices running either Fedora or Android. To consolidate my codebase and distribution I would like to determine which OS I am on. I tried System.getProperty("os.name"), but that just returns "Linux". Is there something unique to Android in the System properties? Thanks
Open the Settings app. Scroll down, tap Utilities, and tap Parallel Apps. You'll see a list of apps that you can make copies of—not every app is supported. Find the app you want to clone, and turn its toggle to the On position.
There are several properties you could check. Candidates are:
Maybe you want to check by yourself?
Properties p = System.getProperties(); Enumeration keys = p.keys(); while(keys.hasMoreElements()) { String key = (String) keys.nextElement(); String value = (String) p.get(key); System.out.println(key + " >>>> " + value); }
I do not know Android but if you do not find some unique system property you can sometimes identify the system if some specific class exists there. So you can do the following:
boolean isAndroid() { try { Class.forName("the class name"); return true; } catch(ClassNotFoundException e) { return false; } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With