The following solution assumes that in manifest file you always set android:debuggable=true while developing and android:debuggable=false for application release.
Now you can check this attribute’s value from your code by checking the ApplicationInfo.FLAG_DEBUGGABLE flag in the ApplicationInfo obtained from PackageManager.
The following code snippet could help:
PackageInfo packageInfo = ... // get package info for your context
int flags = packageInfo.applicationInfo.flags;
if ((flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
// development mode
} else {
// release mode
}