Installing and using Mobile Suite : webMethods Mobile Development Help : Code Snippets : Detecting the Current Platform
Detecting the Current Platform
At runtime, it is often required to get information on the platform on which the application is running. This information may be used, for example, to return a color value that depends on the current platform.
The com.softwareag.mobile.runtime.toolkit.AbstractApplicationController contains public methods for determining the current platform:
boolean runningOnAndroid();
boolean runningOnIOS();
boolean runningOnWinPhone();
boolean runningOnWin8();
These methods can also be used if you want to simulate your application using Phoney. The return value then depends on the activated handset.
See the following snippet for an example:
import com.softwareag.mobile.runtime.toolkit.AbstractApplicationController;

public int getColorValue() {
int colorValue = 0xff000000;
if(AbstractApplicationController.getInstance().runningOnAndroid()) {
colorValue = 0xff00ff00;
}
return colorValue;
}
Copyright © 2007-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback