获取启动传参的参数数据
AndroidJavaObject context = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject javaClass = new AndroidJavaObject("com.xxx.lic.xxx");
AndroidJavaObject intentCLass = context.Call<AndroidJavaObject>("getIntent");
bool hasExtra = intentCLass.Call<bool>("hasExtra", "lic");
if (hasExtra)
{
AndroidJavaObject extras = intentCLass.Call<AndroidJavaObject>("getExtras");
string lic_info = extras.Call<string>("getString", "lic");
}
unity调用aar方法获取数据等:
AndroidJavaObject context = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject javaClass = new AndroidJavaObject("com.xxxx.lic.xxxx");
string valueInfo = javaClass.Call<string>("licCheck", product_id, SN_number);
AndroidJavaObject context = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject javaClass = new AndroidJavaObject("com.xxx.lic.xxx");
string valueInfo = javaClass.Call<string>("licIn", serializeInput.value, product_id, SN_number);