Detecting simulator

16 views
Skip to first unread message

P5music

unread,
Mar 12, 2021, 5:52:03 PM3/12/21
to CodenameOne Discussions
I need a function to detect whether the app is running on the simulator of the IDE (computer) instead of a mobile device.

The platform name is from the skin.
For example I get "ios", or "and".

This is not useful:
public static boolean isSimulator()
{
String os=Display.getInstance().getPlatformName();
System.out.println("os "+os);
if (!(
(os.toLowerCase().contains("ios"))||
(os.toLowerCase().contains("and"))
)) {return true;}
else {return false;}
}

How to detect the fact that the device is simulated?
Thanks

Dave Dyer

unread,
Mar 12, 2021, 11:43:51 PM3/12/21
to CodenameOne Discussions
Display.getInstance().isSimulator();
Reply all
Reply to author
Forward
0 new messages