Add:Core:Initial work on android support
[navit-package] / navit / android.c
1 #include <string.h>
2 #include "android.h"
3 #include <android/log.h>
4 #include "debug.h"
5 #include "callback.h"
6
7 JNIEnv *jnienv;
8 jobject *android_activity;
9
10 /* This is a trivial JNI example where we use a native method
11  * to return a new VM String. See the corresponding Java source
12  * file located at:
13  *
14  *   apps/samples/hello-jni/project/src/com/example/HelloJni/HelloJni.java
15  */
16 JNIEXPORT void JNICALL
17 Java_org_navitproject_navit_Navit_NavitMain( JNIEnv* env, jobject thiz, jobject activity)
18 {
19         char *strings[]={"/data/data/org.navitproject.navit/bin/navit",NULL};
20         __android_log_print(ANDROID_LOG_ERROR,"test","called");
21         jnienv=env;
22         android_activity=activity;
23         dbg(0,"enter env=%p thiz=%p activity=%p\n",env,thiz,activity);
24         main(1, strings);
25 }
26
27 JNIEXPORT void JNICALL
28 Java_org_navitproject_navitgraphics_NavitGraphics_SizeChangedCallback( JNIEnv* env, jobject thiz, int id, int w, int h)
29 {
30         dbg(0,"enter %p %d %d\n",(struct callback *)id,w,h);
31         callback_call_2((struct callback *)id,w,h);
32 }