ADF Mobile: Checking the operating system's name

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: 


System.getProperty("os.name")

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.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Frédéric Desbiens

The musings of a member of the ADF Product Management team.

I focus here on my favorite development framework but also have a strong interest in Mobile Development, Oracle WebCenter and Oracle SOA Suite.

Attentive readers will even find posts about IT Strategy from time to time, an interest of mine since I completed my MBA in 2006.

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today