I created a logger.h file and I include and use it on my c++ code:
#ifndef LOG_TAG
#define LOG_TAG "jni"
#include <android/log.h>
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN,LOG_TAG,__VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
#endif // LOG_TAG
In my java application file I use the following code to detect debug mode:
private boolean inDebugMode() {
boolean inDebugMode = false;
try {
PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
int flags = packageInfo.applicationInfo.flags;
inDebugMode = (flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
} catch (NameNotFoundException e) {
e.printStackTrace();
}
// GlobalData.DEBUG_MODE = inDebugMode;
return inDebugMode;
}
How can I do it on the native code?
Code examples would be appreciated...