Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if my app is being debugged in android?

Is there a way to check within my android application if it's being debugged, like a DEBUG flag or somthing? I want to print a special message when the application is being debugged.

like image 973
ofir dubi Avatar asked Mar 06 '23 03:03

ofir dubi


1 Answers

You can use BuildConfig.DEBUG. This is a boolean value that will be true for a debug build, false otherwise:

if (BuildConfig.DEBUG) {
  // do something with debug build
}
like image 74
chaunv Avatar answered Mar 09 '23 00:03

chaunv