开发者

Checking if Android phone is simulator or real device

开发者 https://www.devze.com 2023-01-18 11:01 出处:网络
Like in Blackberry, do we have any API method (similar t开发者_JS百科o DeviceInfo.isSimulator()) to check if device is simulator or real device?There isn\'t a 100% correct way to do this since the int

Like in Blackberry, do we have any API method (similar t开发者_JS百科o DeviceInfo.isSimulator()) to check if device is simulator or real device?


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.
}
0

精彩评论

暂无评论...
验证码 换一张
取 消