// JVM load the .so and calls this native function static jstring Java_x360video_Activities_xMarshal_stringFromJNI(JNIEnv env, jobject thiz, jobject args) { ConsoleExtensions.trace("enter Java_x360video_Activities_xMarshal_stringFromJNI"); if (args != null) { var loctype = env.GetObjectClass(env, args); var gtype = env.NewGlobalRef(env, loctype); //GlobalActivityClass = (jclass)jni->NewGlobalRef(jni->GetObjectClass(activity)); // var startMovieFromNative = env.GetMethodID(env, loctype, "startMovieFromNative", "(Ljava/lang/String;)V"); ConsoleExtensions.tracei64("startMovieFromNative: ", (int)(object)startMovieFromNative); } // do we have a console yet? //Console.WriteLine("enter Java_AndroidBrowserVRNDK_Activities_xMarshal_stringFromJNI"); var n = env.NewStringUTF; //// if we change our NDK code, will nuget packaing work on the background, and also upgrade running apps? var v = n(env, "hello from Java_x360video_Activities_xMarshal_stringFromJNI. yay"); return v; // ConfigurationCreateNuGetPackage.cs }
// JVM load the .so and calls this native function static long Java_OVROculus360Photos_Activities_xMarshal_nativeSetAppInterface( JNIEnv env, jclass clazz, // ApplicationActivity : com.oculus.vrappframework.VrActivity jobject activity, jstring fromPackageNameString, jstring commandString, jstring uriString ) { // can we do typeof() yet and have our env from there? // Error 3 No overload for method '__android_log_print' takes 3 arguments X:\jsc.svn\examples\java\android\synergy\OVROculus360PhotosNDK\OVROculus360PhotosNDK\xNativeActivity.cs 39 13 OVROculus360PhotosNDK // https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20150721/ovroculus360photoshud ScriptCoreLibAndroidNDK.Library.ConsoleExtensions.trace("enter Java_OVROculus360Photos_Activities_xMarshal_nativeSetAppInterface"); //Oculus360Photos_h.AtStartBackgroundPanoLoad = new object(); xNativeAtStartBackgroundPanoLoad = xNativeAtStartBackgroundPanoLoadInvoke; //xNativeAtStartBackgroundPanoLoad("not yet loaded", null); var loctype = env.GetObjectClass(env, activity); var gtype = (jclass)env.NewGlobalRef(env, loctype); //var gtype = (jclass)env.NewGlobalRef<jclass>(env, loctype); var typeof_this = new __Type { arg0_env = env, arg1_type = gtype }; //var setDefaultLocale = typeof_this.GetMethodID("setDefaultLocale", "()V"); var setDefaultLocale = typeof_this.GetMethod("setDefaultLocale", "()V"); //var setDefaultLocale = env.GetMethodID(env, loctype, "setDefaultLocale", "()V"); //Type.GetMethod(); ConsoleExtensions.tracei64("setDefaultLocale: ", (int)(object)setDefaultLocale); // I/xNativeActivity(24350): [3194400] \xNativeActivity.cs:202 enter Java_OVROculus360Photos_Activities_xMarshal_nativeSetAppInterface //I/xNativeActivity(24350): [3194400] \xNativeActivity.cs:222 setDefaultLocale: -2012160456 // public virtual void setDefaultLocale() //env.NewStringUTF(env, "en"); // error: undefined reference to '__new_jvalue' // env.CallVoidMethodA(env, activity, setDefaultLocale, args: default(jvalue[])); setDefaultLocale.Invoke(activity); return Oculus360Photos_h.Java_com_oculus_oculus360photossdk_MainActivity_nativeSetAppInterface( env, //clazz, gtype, activity, fromPackageNameString, commandString, uriString, arg_AtStartBackgroundPanoLoad: xNativeAtStartBackgroundPanoLoad ); }
// JVM load the .so and calls this native function static void Java_x360video_Activities_xMarshal_startMovieFromUDP(JNIEnv env, jobject thiz, jobject args) { // https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20160103/x360videoui // https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20160103/startmoviefromudp // this needs to be done so that we get to play movie from paused state. ConsoleExtensions.trace("enter Java_x360video_Activities_xMarshal_startMovieFromUDP"); // list all menu items. // if one has the filename we need. activate it? //var menu = this.menuitems[0]; //var __ptr = args.__ptr; //var pathName = args.pathName; var t = new __Type { arg0_env = env, arg1_type = (jclass)env.NewGlobalRef(env, env.GetObjectClass(env, args)) }; //sage: 'sart/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: JNI GetFieldID called with pending exception // 'java.lang.NoSuchFieldError' thrown in void x360video.Activities.xMarshal.startMovieFromUDP(java.lang.Obje var field__ptr = env.GetFieldID(env, t.arg1_type, "__ptr", "J"); var __ptr = env.GetLongField(env, args, field__ptr); ConsoleExtensions.tracei64("__ptr", __ptr); ///xNativeActivity(16201): [14349792] \xNativeActivity.cs:138 fieldpathName -2012062200 ///xNativeActivity(16201): [14349792] \xNativeActivity.cs:139 field__ptr -2012062232 // http://journals.ecs.soton.ac.uk/java/tutorial/native1.1/implementing/example-1.1/FieldAccess.c var fieldpathName = env.GetFieldID(env, t.arg1_type, "pathName", "Ljava/lang/String;"); ConsoleExtensions.tracei64("fieldpathName", (long)(object)fieldpathName); var jstr = (jstring)env.GetObjectField(env, args, fieldpathName); var isCopy = default(bool); var str = env.GetStringUTFChars(env, jstr, out isCopy); ConsoleExtensions.traces("pathName: ", str); //I/xNativeActivity(19611): [13566168] \xNativeActivity.cs:118 enter Java_x360video_Activities_xMarshal_startMovieFromUDP //I/xNativeActivity(19611): [13566168] \xNativeActivity.cs:138 fieldpathName -2012064080 //I/xNativeActivity(19611): [13566168] \xNativeActivity.cs:139 field__ptr -2012064112 //I/xNativeActivity(19611): \xNativeActivity.cs:153 pathName: /storage/emulated/0/Oculus/360Videos/360 3D 3D VR Timelapse Hanriver TB by ___________________.mp3._TB.mp4 // looky. // we jumped from UI to NDK. and we have the string. // now we need to jump into C++ // C:\Windows\system32>x:\util\android-sdk-windows\platform-tools\adb.exe logcat -s "xNativeActivity" "System.Console" "DEBUG" "PlatformActivity" "Oculus360Videos" // Matrix4f Oculus360Videos::Frame( const VrFrame & vrFrame ) ?? Oculus360Videos_h.startMovieFromUDP(env, __ptr, str); ConsoleExtensions.trace("exit Java_x360video_Activities_xMarshal_startMovieFromUDP"); }