Last active
January 8, 2017 09:00
-
-
Save farhadfaghihi/2207706bad1566af241c to your computer and use it in GitHub Desktop.
Detect if the application is running on Emulator, Genymotion or VM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean isRunningOnEmulator() | |
{ | |
Boolean result = false; | |
if( | |
"google_sdk".equalsIgnoreCase(Build.PRODUCT) || | |
"sdk_google_phone_x86".equalsIgnoreCase(Build.PRODUCT) || | |
"sdk".equalsIgnoreCase(Build.PRODUCT) || | |
"sdk_x86".equalsIgnoreCase(Build.PRODUCT) || | |
"vbox86p".equalsIgnoreCase(Build.PRODUCT) || | |
Build.FINGERPRINT.contains("generic") || | |
Build.MANUFACTURER.contains("Genymotion") || | |
Build.MODEL.contains("Emulator") || | |
Build.MODEL.contains("Android SDK built for x86")) | |
{ | |
result = true; | |
} | |
if(Build.BRAND.contains("generic") && Build.DEVICE.contains("generic")) | |
{ | |
result = true; | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment