我想知道是否有任何方法可以发现设备是模拟器还是物理设备。
我不希望我的应用程序安装在模拟器上。
发布于 2020-04-28 17:27:41
可以使用flutter_is_emulator来标识仿真器或仿真器。
bool isAnEmulator = await FlutterIsEmulator.isDeviceAnEmulatorOrASimulator;要使其正常工作,您需要首先将应用程序安装到模拟器/模拟器中。
您也可以使用另一个流行的flutter包device_info来完成此操作。
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
print('Is emulator: ${androidInfo.isPhysicalDevice}');
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
print('Is simulator: ${iosInfo.isPhysicalDevice}'); 发布于 2020-04-28 17:40:06
trust_fall有以下检查:
检查设备JailBroken是否在iOS/Android上?
bool isJailBroken = await TrustFall.isJailBroken;检查设备是真实的还是仿真的
bool isRealDevice = await TrustFall.isRealDevice;这个设备可以模拟位置吗--不需要root!
bool canMockLocation = await TrustFall.canMockLocation;(仅限ANDROID)检查应用程序是否在外部存储上运行
bool isOnExternalStorage = await TrustFall.isOnExternalStorage;检查设备是否违反上述任何条件
bool isTrustFall = await TrustFall.isTrustFall;https://stackoverflow.com/questions/61476797
复制相似问题