0

For the application that I am developing, there are some menu items that are helpful for debugging the app (something like resetting counts and stuff).

Is there a way (a directive in xml file or else) to tell android to show/hide certain menu items depending on the app being in debug mode or not?

The only thing I know is the following code, that we can do in the Activity itself, I wonder if it can be used to show/hide menu items:

boolean isDebugBuild = (0 != ( //Check if the app is in debug mode
        getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));

Or maybe is there a way to do this in onCreateOptionsMenu()

Fortega
  • 19,463
  • 14
  • 75
  • 113
Dumbo
  • 13,555
  • 54
  • 184
  • 288

1 Answers1

0

Add this in your AndroidManifest application tag

android:debuggable=true

and in onCreateOptionsMenu check

 if (BuildConfig.DEBUG) {
        //true for debuggable mode
    } else {
    }
scottt
  • 8,301
  • 1
  • 31
  • 41
Meenal
  • 2,879
  • 5
  • 19
  • 43