Is it possible to programmatically detect if is real or a virtual Android device?

android, android-emulator

Solution

You can try, by checking `Build.DEVICE` which for not real device shall read `generic` or check `Build.PRODUCT` which would be `sdk`.

Problem

In my Android application I have to use accelerometer and other sensors. Since this sensors aren't emulated by a Virtual Device, I've to use SensorSimulator project. The problem is that SensorSimulator's APIs look different from Android's ones. So I've to use different code if I'm in a real or in a virtual device. Does it exists a way to programmatically detect it? Or do you know other solutions?

Original source

Related problems