A Cordova plugin that provides robust detection of Android emulators, including popular ones like BlueStacks, NOX, Andy, and standard Android emulators.
- Comprehensive emulator detection using multiple verification methods
- Detects popular Android emulators:
- BlueStacks
- NOX
- Android Studio Emulator
- Genymotion
- Andy
- Other QEMU-based emulators
- No special permissions required
- Lightweight and easy to use
- Promise-based API
cordova plugin add cordova-plugin-emulator-detector
Or install directly from GitHub:
cordova plugin add https://github.com/rizalrinoldi/cordova-plugin-emulator-detector.git
EmulatorDetector.isEmulator(
function(isEmulator) {
if (isEmulator === 1) {
console.log("Running on emulator");
} else {
console.log("Running on real device");
}
},
function(error) {
console.error("Error detecting device type:", error);
}
);
// Using Promise wrapper
function checkEmulator() {
return new Promise((resolve, reject) => {
EmulatorDetector.isEmulator(
isEmulator => resolve(isEmulator === 1),
error => reject(error)
);
});
}
// Usage with async/await
async function checkDevice() {
try {
const isEmulator = await checkEmulator();
if (isEmulator) {
console.log("This is an emulator");
} else {
console.log("This is a real device");
}
} catch (error) {
console.error("Error checking device:", error);
}
}
The plugin uses multiple detection methods to ensure accuracy:
-
Basic Properties Detection
- Build.FINGERPRINT
- Build.MODEL
- Build.MANUFACTURER
- Build.BRAND
- Build.DEVICE
- Build.PRODUCT
- Build.HARDWARE
- Build.BOOTLOADER
-
Advanced Emulator Properties
- Specific manufacturer checks
- Model name verification
- Product name analysis
-
File System Checks
- Emulator-specific libraries
- System binaries
- QEMU-related files
-
Package Detection
- Checks for installed emulator packages
- Verifies emulator-related services
-
QEMU Detection
- CPU information analysis
- Hardware configuration checks
-
Hardware Configuration
- System property verification
- Hardware type analysis
- Android
- Cordova 9.0.0 or higher
- Android API 19 or higher
- Only works on Android devices
- Some newer or heavily modified emulators might not be detected
- Detection methods may need updates as emulator technology evolves
Contributions are welcome! Please feel free to submit a Pull Request.
- Clone the repository
git clone https://github.com/rizalrinoldi/cordova-plugin-emulator-detector.git
- Install dependencies
npm install
- Test the plugin
npm test
MIT License
For bugs, feature requests, or questions, please create an issue.
- Initial release
- Added comprehensive emulator detection
- Support for major Android emulators
- Basic and advanced detection methods
- File system and package checks
- Rizal
- Android Open Source Project
- Cordova community
- Contributors to similar emulator detection projects
A: Some emulators use sophisticated methods to hide their presence. If you encounter an undetected emulator, please create an issue with the emulator details.
A: The plugin performs checks only when explicitly called and has minimal impact on performance.
A: Like any detection method, it's possible for sophisticated users to bypass these checks. This plugin is meant for general use cases and basic security measures.
A: Currently, this plugin only supports Android devices. iOS support may be added in future versions.