Android Developer
Android Developer

Reputation: 127

Checking if Android phone is simulator or real device

Like in Blackberry, do we have any API method (similar to DeviceInfo.isSimulator()) to check if device is simulator or real device?

Upvotes: 3

Views: 4528

Answers (1)

Alex Lockwood
Alex Lockwood

Reputation: 83303

There isn't a 100% correct way to do this since the internal constants seem to change every once in a while. This works for me though:

if (android.os.Build.MODEL.contains("google_sdk") ||
    android.os.Build.MODEL.contains("Emulator")) {
    // Then you are running the app on the emulator.
}

Upvotes: 1

Related Questions