Reputation: 123
I have a device that is connected to my PC. Is it possible to know this device is real phone or emulator using adb? If it is possible then how can i do it? Google and documentation didn't solve my problem.
Upvotes: 0
Views: 322
Reputation: 69198
You can use adb get-serialno
to obtain the serial number of the device. On the emulator the serial number starts with emulator-
.
Upvotes: 2
Reputation: 608
You can use the -d
and -e
options to adb.
Eg in a script, then you can use adb -d shell true
which will return error: no devices found
and a non-zero exit status if you have an emulator running rather than a device attached, or a zero exit status if a device is attached.
Similarly you could use adb -e shell true
.
Upvotes: 0