当前位置: 代码迷 >> 综合 >> Unity-如何隐藏App入口,然后通过其他App打开
  详细解决方案

Unity-如何隐藏App入口,然后通过其他App打开

热度:47   发布时间:2023-09-21 22:46:52.0

如何将统一打包出来的APK隐藏,然后通过其他APK打开它。我在网上查了半天试了半天。就在要下班的时候试到一种是可以实现的。这边废话不多说,直接上代码。

  1. 隐藏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);

这样代码就完成了。至于如何在统一中调用打开隐藏APP的实现我在前面的博客中已经详细的写过了。有需要的可以去看一下。

3.在以上实现完之后,我发现打开隐藏APP的时候,会有短暂白屏,这边也是需要修改AndroidMainfests文件:

android:theme =“@ style / UnityThemeSelector”这句表示窗口样式,修改这句就好了。

只需要将这句改为android:theme =“@ android:style / Theme.Translucent.NoTitleBar

现在就大功告成啦!亲测有效!