Disable GoogleAnalytics from Android App when testing or developing
问题 I'm using EasyTracker in my Android App and I need a way to disable Analytics tracking when the app is in "development" or "testing" mode (I have a flag in a constants file to discriminate). What's the best way to do so? Thanks! 回答1: You can use a class with a static boolean value let's say DEBUG like this : public final class BuildMode { public final static boolean DEBUG = true; } In code, just use : if (BuildMode.DEBUG) ... This is a solution working on all android SDK versions! 回答2: I