By Blueberry Coder on Feb 04, 2013
Recently, somebody asked on the OTN forums how to check the name of the operating system from an ADF Mobile application. This is useful in order to provide a user experience better tailored to a specific mobile platform, for example.
The first idea I had was to query the JVM's built-in properties:
This, however, returns Linux on an Android device. This is not surprising, as Google's mobile OS uses the Linux kernel as its foundation. On the other hand, this answer lacks specificity. How can we get a better one?
Turns out the most reliable way to achieve this task is to use the DeviceManager interface, which supports the DeviceFeatures data control.
DeviceManager device = DeviceManagerFactory.getDeviceManager();
String os = device.getOs();
The code sample above will return Android as expected on my device.