AndroidJavaObject.GetRawObject

Declaration

public IntPtr GetRawObject();

Description

Retrieves the raw jobject pointer to the Java object.

Note: Using raw JNI functions requires advanced knowledge of the Android Java Native Interface (JNI).

Additional resources: AndroidJavaObject.GetRawClass

using System;
using UnityEngine;
public class AndroidJavaObjectGetRawObjectExample: MonoBehaviour
{
    void Start()
    {
        using (AndroidJavaObject javaObject = new AndroidJavaObject("com.example.exampleunityplugin.ExampleJavaClass"))
        {
            IntPtr rawObject = javaObject.GetRawObject();
            string message = javaObject.Call<string>("getMessage");
            Debug.Log("Message: " + message + " Pointer: "+ rawObject);
        }
    }
}

Did you find this page useful? Please give it a rating: