我想知道是否可以找到该设备是模拟器还是物理设备。
我不希望我的应用程序安装在模拟器上。
答案 0 :(得分:1)
您可以使用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}');
答案 1 :(得分:1)
trust_fall具有以下检查:
检查设备是否在iOS / Android上越狱?
bool isJailBroken = await TrustFall.isJailBroken;
检查设备是真实设备还是仿真器
bool isRealDevice = await TrustFall.isRealDevice;
此设备可以模拟位置-无需root!
bool canMockLocation = await TrustFall.canMockLocation;
(仅限ANDROID)检查应用程序是否在外部存储设备上运行
bool isOnExternalStorage =等待TrustFall.isOnExternalStorage; 检查设备是否违反以上任何条件
bool isTrustFall = await TrustFall.isTrustFall;