public void Init(JNIEnv env, JniLocalHandle handle) { if (JniLocalHandle.IsNull(handle)) mJvmHandle = null; else mJvmHandle = env.NewGlobalRef(handle); }
public static unsafe void Unregister(JniHandle clazz, JNIEnv env) { JNIResult res = env.UnregisterNatives(clazz); if (res != JNIResult.JNI_OK) { throw new JNIException("Can't unbind native methods to class."); } }
public JavaException(JNIEnv env) { Type type = GetType(); mIsClrObject = type.GetCustomAttributes(typeof(JavaClassAttribute), false).Length == 0 && type.GetCustomAttributes(typeof(JavaProxyAttribute), false).Length == 0; //if (!mIsClrObject) // GC.SuppressFinalize(this); }
public static unsafe void Register(List<JNINativeMethod> registrations, JniHandle clazz, JNIEnv env) { JNINativeMethod[] methods = registrations.ToArray(); JNIResult res = env.RegisterNatives(clazz, methods, methods.Length); if (res!=JNIResult.JNI_OK) { throw new JNIException("Can't bind native methods to class. Is it in system classloader?"); } }
public JNIResult AttachCurrentThread(out JNIEnv penv, JavaVMInitArgs? args) { IntPtr env; JNIResult result; if (args.HasValue) { JavaVMInitArgs initArgs = args.Value; result = attachCurrentThread.Invoke(native, out env, &initArgs); } else { result = attachCurrentThread.Invoke(native, out env, null); } penv = new JNIEnv(env); return result; }
public JNIResult AttachCurrentThread(out JNIEnv penv, JavaVMInitArgs? args) { IntPtr env; JNIResult result; if (args.HasValue) { throw new Exception("AttachCurrentThread"); JavaVMInitArgs initArgs = args.Value; result = attachCurrentThread.Invoke(native, out env, IntPtr.Zero); } else { result = attachCurrentThread.Invoke(native, out env, IntPtr.Zero); } penv = new JNIEnv(env); return result; }
public JNIResult GetEnv(out JNIEnv penv, int version) { IntPtr env; JNIResult result = getEnv.Invoke(native, out env, version); penv = new JNIEnv(env); return result; }
public JNIResult AttachCurrentThreadAsDaemon(out JNIEnv penv, JavaVMInitArgs? args) { IntPtr env; JNIResult result; if (args.HasValue) { throw new Exception("AttachCurrentThreadAsDaemon"); JavaVMInitArgs value = args.Value; result = attachCurrentThreadAsDaemon.Invoke(native, out env, IntPtr.Zero); } else { result = attachCurrentThreadAsDaemon.Invoke(native, out env, IntPtr.Zero); } if (result == JNIResult.JNI_OK) { penv = new JNIEnv(env); } else { penv = null; } return result; }
public void Register(JniHandle clazz, JNIEnv env) { List<JNINativeMethod> l = new List<JNINativeMethod>(); l.Add(this); Register(l, clazz, env); }
public void Init(JNIEnv env, JniLocalHandle handle) { mJvmHandle = env.NewGlobalRef(handle); }
public JavaException(JNIEnv env) { Type type = GetType(); mIsClrObject = type.GetCustomAttributes(typeof(JavaClassAttribute), false).Length == 0 && type.GetCustomAttributes(typeof(JavaProxyAttribute), false).Length == 0; }