开发者

How can I determine if my Android application is running in an AVD [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

How can I detect the Android emulator?

Is there a way to reliably and programatically determine if my app is running on an AVD vs. real hardware?

Previously I've had good luck checking MAC addresses, but I'm not sure if AVD's all have the same first AA:BB:CC portion (like stock VMWare or VirtualBox Virtual Machines do).

I use a lot of Log.i() calls while learning to code Android Java. But this 开发者_Go百科logging will murder a real phone (and is just rude to waste the user's space and resources). I figure I could wrap my Logging like this pseudo-code:

public void Loggy(String s)
{
  if (!DEVELOPER) return true;

  Log.i(MYAPP,s);
}

I've searched and the closest I see are people asking the same question but for iPhone.


See How can I detect when an Android application is running in the emulator?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜