Created
November 12, 2012 00:24
-
-
Save douyw/4056908 to your computer and use it in GitHub Desktop.
android jni support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef OS_ANDROID | |
#include <android/log.h> | |
/*#include <string.h>*/ | |
#include <jni.h> | |
#define LOG_TAG "libexample" | |
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,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 // OS_ANDROID | |
#ifdef OS_ANDROID | |
jint | |
Java_com_example_MainActivity_start( JNIEnv* jnienv, | |
jobject thiz, jstring path ) | |
{ | |
const char *cpath = (*jnienv)->GetStringUTFChars(jnienv, path, NULL), PATH_MAX); | |
// TODO: free cpath | |
// (*jnienv)->FreeUTFChars | |
return 0; // return port if ok, otherwise 0 | |
} | |
jint | |
Java_com_example_MainActivity_stop( JNIEnv* jnienv, | |
jobject thiz ) | |
{ | |
return 0; | |
} | |
#endif // OS_ANDROID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment