开发者

Determining whether target is an emulator or phone at runtime

In android, is there a way to determine whether an emulator or a phone is being used at runtime?

The reason: I ask because I am using opengl in my app, which doesn't work on the emulator. So I would like to be able to shut opengl down automatically 开发者_StackOverflow社区(or never start it up) when an emulator is used so I can still test the other parts of my app on the emulator.


if(Build.MANUFACTURER.equals("unknown")) {
    // Emulator
}
else {
    // Not Emulator
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜