Indicates the Java instance of the current context.
For more information, refer to the Android developer documentation on Context.
Note: This object is managed by Unity runtime, so do not call AndroidJavaObject.Dispose on it.
using UnityEngine; using UnityEngine.Android;
public class Controller : MonoBehaviour { void Start() { var isRunningGameActivity = AndroidApplication.currentContext.Call<string>("getLocalClassName").Equals("com.unity3d.player.UnityPlayerGameActivity"); var isRunningActivity = AndroidApplication.currentContext.Call<string>("getLocalClassName").Equals("com.unity3d.player.UnityPlayerActivity"); Debug.Log($"GameActivity {isRunningGameActivity}"); Debug.Log($"Activity {isRunningActivity}"); } }