-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed as not planned
Closed as not planned
Copy link
Labels
questionFurther information is requestedFurther information is requested
Description
What is your question?
Here's my code for detecting if my apps run on a real device or emulator.
Future<bool> isRealDevice() async {
try {
if (Platform.isAndroid) {
AndroidDeviceInfo androidDeviceInfo =
await deviceInfoPlugin.androidInfo;
return androidDeviceInfo.isPhysicalDevice;
}
if (Platform.isIOS) {
IosDeviceInfo iosDeviceInfo = await deviceInfoPlugin.iosInfo;
return iosDeviceInfo.isPhysicalDevice;
}
return false;
} catch (e) {
return false;
}
}
When I'm using Android Studio Emulator it is successfully detected as not a real device.
But when I tested it on BlueStacks emulator, it was detected as a real device (not emulated, as it should be).
it also happens in MEmu emulator (it was detected as a real device).
Checklist before submitting a question
- I searched issues in this repository and couldn't find such bug/problem
- I Google'd a solution and I couldn't find it
- I searched on StackOverflow for a solution and I couldn't find it
- I read the README.md file of the plugin
- I am using the latest version of the plugin
- All dependencies are up to date with
flutter pub upgrade - I did a
flutter clean - I tried running the example project
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested