0

In my app I use Google Analytics and Admob as you know (or not) I can use both of them in a mode that doesn't influences the data on the server (debug mode).

I tired of changing each time I release my app this things and I can also mistake and release it with debug mode and then I won't get data...

How can I know programmatically if I run in debug\release mode?

In C# I can check this using:

#If DEBUG then

How can I do this in Android?

Alex K
  • 5,092
  • 15
  • 50
  • 77

1 Answers1

2

You can try by checking the flag

BuildConfig.DEBUG

And this is how I use normally.

if (BuildConfig.DEBUG) {
  Log.e(Constants.TAG, "onCreate called");
}
Intrications
  • 16,782
  • 9
  • 50
  • 50
Ye Lin Aung
  • 11,234
  • 8
  • 45
  • 51