Due to app security concern I need to restrict a certain app from being able to run on emulator. How can CN1 android build app be restricted from running on emulators like Android studio and Genymotion emulators?
Asked
Active
Viewed 64 times
2 Answers
1
This seemed like something easy to make so I added it in a PR here. It should be available in next weeks update and would work using code like this in your start method:
if(getProperty("Emulator", "false").equals("true")) {
throw new RuntimeException("Emulator not supported");
}
I based this change on this and this update.

Shai Almog
- 51,749
- 5
- 35
- 65
-
This will be a nice security feature – Eric May 13 '23 at 19:56
0
Since emulators are rooted by default, adding rooted device check at the start() or runApp() functions of the app is also a great solution.
public void start() {
if (JailbreakDetect.isJailbreakDetectionSupported()) {
if (JailbreakDetect.isJailbroken()) {
Log.p("Device is rooted, killing the app...");
Display.getInstance().exitApplication();
} else {
//proceed
}
} else {
Log.p("Rooted device check unsupported");
Display.getInstance().exitApplication();
}
}
This is working perfectly in online emulators like Appetize.io and Genymotion Cloud

Eric
- 174
- 1
- 8