1.在AndroidManifest.xml里面添加
<activity android:name="com.adsdk.unity.UnityPlayerProxyActivity" android:launchMode="singleTop" android:exported="true">
<intent-filter >
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
2.把下面的UnityPlayerProxyActivity添加进来就可以直接使用了
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.adsdk.unity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class UnityPlayerProxyActivity extends Activity {
public UnityPlayerProxyActivity() {
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!this.isTaskRoot()) {
Intent intent = this.getIntent();
if (intent != null) {
String action = intent.getAction();
if (intent.hasCategory("android.intent.category.LAUNCHER") && "android.intent.action.MAIN".equals(action)) {
this.finish();
return;
}
}
}
try {
Class clazz = Class.forName("com.unity3d.player.UnityPlayerActivity");
Intent intent = new Intent(this, clazz);
this.startActivity(intent);
} catch (ClassNotFoundException var4) {
var4.printStackTrace();
}
}
}