Vertigo
Vertigo

Reputation: 123

Connected device is a device or an emulator

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

Answers (2)

Diego Torres Milano
Diego Torres Milano

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

JatraTim
JatraTim

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

Related Questions