using System; using UnityEngine; public class UnityCallAndroid : MonoBehaviour { private AndroidJavaObject RTKManager; void Start() { Func(); } public void Func() { AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject jo = jc.GetStatic("currentActivity"); try { RTKManager = new AndroidJavaObject("com.bxzzbdh.rtktest.RTK", jo); Debug.Log("RTK Has Been Called"); } catch (Exception e) { Debug.LogError($"Func Expection{e}"); } StartRtk(); } public void StartRtk() { try { RTKManager.Call("StartRTK"); } catch (Exception e) { Debug.LogError($"StartRTK Expection{e}"); } } private void OnApplicationQuit() { RTKManager.Call("StopRTK"); } }