CallAnotherApp.java 具体的内容如下:
package com.example.callandroidapp;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.widget.Toast;
public class CallAnotherApp {
/** * 设置一个 Activity 参数 */
private Activity _unityActivity;
/** * 通过反射获取 Unity 的 Activity 的上下文 */
Activity getActivity(){
if(null == _unityActivity){
try{
Class> classtype = Class.forName("com.unity3d.player.UnityPlayer");
Activity activity = (Activity) classtype.getDeclaredField("currentActivity").get(classtype);
_unityActivity = activity;
}catch (ClassNotFoundException e){
e.printStackTrace();
}catch (IllegalAccessException e){