Hello Fadil
Not sure on how you can prevent the app from running on an emulator, but I know a way to discover if your app is on emulator or not.
// This file was generated by Mendix Studio Pro.
//
// WARNING: Only the following code will be retained when actions are regenerated:
// - the import list
// - the code between BEGIN USER CODE and END USER CODE
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
import "mx-global";
import { Big } from "big.js";
import DeviceInfo from 'react-native-device-info';
// BEGIN EXTRA CODE
// END EXTRA CODE
/**
* @returns {Promise.<void>}
*/
export async function JSA_IsEmulator() {
// BEGIN USER CODE
DeviceInfo.isEmulator().then((isEmulator) => {
if (isEmulator) {
console.info("EMULATOR");
alert("EMULATOR");
}
else {
console.info("NOT EMULATOR");
alert("NOT EMULATOR");
}
});
// END USER CODE
}
npm install --save react-native-device-info
After run your project you get the results below (it is a GIF animation, scroll right to see the emulator/device side by side and the correct emulator/not_emulator identification):
Maybe you canuse this lib and call the isEmulator method from the onload event on the AppEvents widget and block the usage of the app if isEmulator == true