Is there a way to access the Activity or Application Context for plugin development?
Say I have a method like this:
public static void myMethod(Context context, String s1, String s2)
How would I call this method from Unity?
Right now I'm trying something like this. The problem is obj_Activity is an Activity type ? How would I pass in the App or Activity Context in this case?
// first we try to find our main activity..
IntPtr cls_Activity = JNI.FindClass("com/unity3d/player/UnityPlayer");
int fid_Activity = JNI.GetStaticFieldID(cls_Activity, "currentActivity", "Landroid/app/Activity;");
obj_Activity = JNI.GetStaticObjectField(cls_Activity, fid_Activity);
Debug.Log("obj_Activity = " + obj_Activity);
AndroidJavaClass myClass = new AndroidJavaClass("com.test.myClass");
myClass.CallStatic("myMethod",
obj_Activity,
new AndroidJavaObject("java.lang.String", "string1"),
new AndroidJavaObject("java.lang.String", "string2"));