如何将统一打包出来的APK隐藏,然后通过其他APK打开它。
隐藏APK图标,即APK入口,这里需要重新配置Androidmanifests文件,在这个文件里将活动标签里的内容改成下面的代码:
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<data android:scheme="xl" android:host="goods" android:path="/goodsDetail" android:port="8888"/>
<!--下面这几行也必须得设置-->
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
2.在安卓中添加如何打开隐藏应用程序的代码:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("xl://goods:8888/goodsDetail?goodsId=10011002"));
startActivity(intent);
这样代码就完成了。
3.在以上实现完之后,我发现打开隐藏APP的时候,会有短暂白屏,这边也是需要修改AndroidMainfests文件:
android:theme =“@ style / UnityThemeSelector”这句表示窗口样式,修改这句就好了。
只需要将这句改为android:theme =“@ android:style / Theme.Translucent.NoTitleBar
亲测有效!
————————————————