Legacy Documentation: Version 4.6(go to latest)
Language: English
  • C#
  • JS
  • Boo

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

AndroidJNI

Namespace: UnityEngine

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

'Raw' JNI interface to Android Dalvik (Java) VM from Mono (CS/JS).

Static Functions

AllocObject Allocates a new Java object without invoking any of the constructors for the object.
AttachCurrentThread Attaches the current thread to a Java (Dalvik) VM.
CallBooleanMethod Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.
CallByteMethod Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.
CallCharMethod Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.
CallDoubleMethod Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.
CallFloatMethod Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.
CallIntMethod Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.
CallLongMethod Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.
CallObjectMethod Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.
CallShortMethod Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.
CallStaticBooleanMethod Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.
CallStaticByteMethod Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.
CallStaticCharMethod Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.
CallStaticDoubleMethod Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.
CallStaticFloatMethod Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.
CallStaticIntMethod Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.
CallStaticLongMethod Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.
CallStaticObjectMethod Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.
CallStaticShortMethod Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.
CallStaticStringMethod Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.
CallStaticVoidMethod Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.
CallStringMethod Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.
CallVoidMethod Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.
DeleteGlobalRef Deletes the global reference pointed to by obj.
DeleteLocalRef Deletes the local reference pointed to by obj.
DetachCurrentThread Detaches the current thread from a Java (Dalvik) VM.
EnsureLocalCapacity Ensures that at least a given number of local references can be created in the current thread.
ExceptionClear Clears any exception that is currently being thrown.
ExceptionDescribe Prints an exception and a backtrace of the stack to the logcat
ExceptionOccurred Determines if an exception is being thrown.
FatalError Raises a fatal error and does not expect the VM to recover. This function does not return.
FindClass This function loads a locally-defined class.
FromBooleanArray Convert a Java array of boolean to a managed array of System.Boolean.
FromByteArray Convert a Java array of byte to a managed array of System.Byte.
FromCharArray Convert a Java array of char to a managed array of System.Char.
FromDoubleArray Convert a Java array of double to a managed array of System.Double.
FromFloatArray Convert a Java array of float to a managed array of System.Single.
FromIntArray Convert a Java array of int to a managed array of System.Int32.
FromLongArray Convert a Java array of long to a managed array of System.Int64.
FromObjectArray Convert a Java array of java.lang.Object to a managed array of System.IntPtr, representing Java objects.
FromReflectedField Converts a java.lang.reflect.Field to a field ID.
FromReflectedMethod Converts a java.lang.reflect.Method or java.lang.reflect.Constructor object to a method ID.
FromShortArray Convert a Java array of short to a managed array of System.Int16.
GetArrayLength Returns the number of elements in the array.
GetBooleanArrayElement Returns the value of one element of a primitive array.
GetBooleanField This function returns the value of an instance (nonstatic) field of an object.
GetByteArrayElement Returns the value of one element of a primitive array.
GetByteField This function returns the value of an instance (nonstatic) field of an object.
GetCharArrayElement Returns the value of one element of a primitive array.
GetCharField This function returns the value of an instance (nonstatic) field of an object.
GetDoubleArrayElement Returns the value of one element of a primitive array.
GetDoubleField This function returns the value of an instance (nonstatic) field of an object.
GetFieldID Returns the field ID for an instance (nonstatic) field of a class.
GetFloatArrayElement Returns the value of one element of a primitive array.
GetFloatField This function returns the value of an instance (nonstatic) field of an object.
GetIntArrayElement Returns the value of one element of a primitive array.
GetIntField This function returns the value of an instance (nonstatic) field of an object.
GetLongArrayElement Returns the value of one element of a primitive array.
GetLongField This function returns the value of an instance (nonstatic) field of an object.
GetMethodID Returns the method ID for an instance (nonstatic) method of a class or interface.
GetObjectArrayElement Returns an element of an Object array.
GetObjectClass Returns the class of an object.
GetObjectField This function returns the value of an instance (nonstatic) field of an object.
GetShortArrayElement Returns the value of one element of a primitive array.
GetShortField This function returns the value of an instance (nonstatic) field of an object.
GetStaticBooleanField This function returns the value of a static field of an object.
GetStaticByteField This function returns the value of a static field of an object.
GetStaticCharField This function returns the value of a static field of an object.
GetStaticDoubleField This function returns the value of a static field of an object.
GetStaticFieldID Returns the field ID for a static field of a class.
GetStaticFloatField This function returns the value of a static field of an object.
GetStaticIntField This function returns the value of a static field of an object.
GetStaticLongField This function returns the value of a static field of an object.
GetStaticMethodID Returns the method ID for a static method of a class.
GetStaticObjectField This function returns the value of a static field of an object.
GetStaticShortField This function returns the value of a static field of an object.
GetStaticStringField This function returns the value of a static field of an object.
GetStringField This function returns the value of an instance (nonstatic) field of an object.
GetStringUTFChars Returns a managed string object representing the string in modified UTF-8 encoding.
GetStringUTFLength Returns the length in bytes of the modified UTF-8 representation of a string.
GetSuperclass If clazz represents any class other than the class Object, then this function returns the object that represents the superclass of the class specified by clazz.
GetVersion Returns the version of the native method interface.
IsAssignableFrom Determines whether an object of clazz1 can be safely cast to clazz2.
IsInstanceOf Tests whether an object is an instance of a class.
IsSameObject Tests whether two references refer to the same Java object.
NewBooleanArray Construct a new primitive array object.
NewByteArray Construct a new primitive array object.
NewCharArray Construct a new primitive array object.
NewDoubleArray Construct a new primitive array object.
NewFloatArray Construct a new primitive array object.
NewGlobalRef Creates a new global reference to the object referred to by the obj argument.
NewIntArray Construct a new primitive array object.
NewLocalRef Creates a new local reference that refers to the same object as obj.
NewLongArray Construct a new primitive array object.
NewObject Constructs a new Java object. The method ID indicates which constructor method to invoke. This ID must be obtained by calling GetMethodID() with <init> as the method name and void (V) as the return type.
NewObjectArray Constructs a new array holding objects in class clazz. All elements are initially set to obj.
NewShortArray Construct a new primitive array object.
NewStringUTF Constructs a new java.lang.String object from an array of characters in modified UTF-8 encoding.
PopLocalFrame Pops off the current local reference frame, frees all the local references, and returns a local reference in the previous local reference frame for the given result object.
PushLocalFrame Creates a new local reference frame, in which at least a given number of local references can be created.
SetBooleanArrayElement Sets the value of one element in a primitive array.
SetBooleanField This function sets the value of an instance (nonstatic) field of an object.
SetByteArrayElement Sets the value of one element in a primitive array.
SetByteField This function sets the value of an instance (nonstatic) field of an object.
SetCharArrayElement Sets the value of one element in a primitive array.
SetCharField This function sets the value of an instance (nonstatic) field of an object.
SetDoubleArrayElement Sets the value of one element in a primitive array.
SetDoubleField This function sets the value of an instance (nonstatic) field of an object.
SetFloatArrayElement Sets the value of one element in a primitive array.
SetFloatField This function sets the value of an instance (nonstatic) field of an object.
SetIntArrayElement Sets the value of one element in a primitive array.
SetIntField This function sets the value of an instance (nonstatic) field of an object.
SetLongArrayElement Sets the value of one element in a primitive array.
SetLongField This function sets the value of an instance (nonstatic) field of an object.
SetObjectArrayElement Sets an element of an Object array.
SetObjectField This function sets the value of an instance (nonstatic) field of an object.
SetShortArrayElement Sets the value of one element in a primitive array.
SetShortField This function sets the value of an instance (nonstatic) field of an object.
SetStaticBooleanField This function ets the value of a static field of an object.
SetStaticByteField This function ets the value of a static field of an object.
SetStaticCharField This function ets the value of a static field of an object.
SetStaticDoubleField This function ets the value of a static field of an object.
SetStaticFloatField This function ets the value of a static field of an object.
SetStaticIntField This function ets the value of a static field of an object.
SetStaticLongField This function ets the value of a static field of an object.
SetStaticObjectField This function ets the value of a static field of an object.
SetStaticShortField This function ets the value of a static field of an object.
SetStaticStringField This function ets the value of a static field of an object.
SetStringField This function sets the value of an instance (nonstatic) field of an object.
Throw Causes a java.lang.Throwable object to be thrown.
ThrowNew Constructs an exception object from the specified class with the message specified by message and causes that exception to be thrown.
ToBooleanArray Convert a managed array of System.Boolean to a Java array of boolean.
ToByteArray Convert a managed array of System.Byte to a Java array of byte.
ToCharArray Convert a managed array of System.Char to a Java array of char.
ToDoubleArray Convert a managed array of System.Double to a Java array of double.
ToFloatArray Convert a managed array of System.Single to a Java array of float.
ToIntArray Convert a managed array of System.Int32 to a Java array of int.
ToLongArray Convert a managed array of System.Int64 to a Java array of long.
ToObjectArray Convert a managed array of System.IntPtr, representing Java objects, to a Java array of java.lang.Object.
ToReflectedField Converts a field ID derived from cls to a java.lang.reflect.Field object.
ToReflectedMethod Converts a method ID derived from clazz to a java.lang.reflect.Method or java.lang.reflect.Constructor object.
ToShortArray Convert a managed array of System.Int16 to a Java array of short.