How can I determine if my Android application is running in an AVD [duplicate]
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?
精彩评论