SteAp
SteAp

Reputation: 11999

Detecting app run on emulator or real device

I need to detect, if an app is running on an iOS or Android emulator to skip an QR code scan method and just return a scanned code.

Q: How do I detect

Upvotes: 2

Views: 2580

Answers (2)

Anandh Krishnan
Anandh Krishnan

Reputation: 6022

safe_device: ^1.1.1

import 'package:safe_device/safe_device.dart';

Checks whether device is real or emulator

bool isRealDevice = await SafeDevice.isRealDevice;

(ANDROID ONLY) Check if development Options is enable on device

bool isDevelopmentModeEnable = await SafeDevice.isDevelopmentModeEnable;

Upvotes: 0

SteAp
SteAp

Reputation: 11999

Just found this plugin, which prints various details:

https://pub.dartlang.org/packages/device_info#-readme-tab-

Output on Android emulator [see last line]:

enter image description here

Upvotes: 1

Related Questions