I have a requirement for creating call backs between native code ( c language code) and Android code .
I wrote JNI functions for calling C code from the androi
Try this :
JNIEXPORT void JNICALL Java_org_pjsip_pjsua_pjsua_1appJNI_initSocket(JNIEnv *jenv, jobject obj) {
__android_log_write(ANDROID_LOG_INFO, " JNI CODE ", " APP INIT SOCKET");
initSocket();
// jclass cls = (*jenv)->GetObjectClass(jenv, obj);
// or something like this :
jclass cls = (*jenv)->FindClass(jenv, "org/pjsip/pjsua/pjsua_appJNI");
jmethodID methodid = (*jenv)->GetStaticMethodID(jenv, cls, "callback", "(Ljava/lang/String;)V");
if(!methodid) {
return;
}
jstring jstr = (*jenv)->NewStringUTF(jenv, "Hello from C");
(*jenv)->CallStaticVoidMethod(jenv, cls, methodid, jstr);
}