Android-隐藏app图标以及隐式启动

时间:2021-07-09 05:36:49

隐藏APP桌面图标

<activity android:name=".LaunchActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<data android:host="LaunchActivity" android:scheme="com.tuobang.xsfx" tools:ignore="AppLinkUrlError"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
  • 在manifest的入口activity里面intent-filter中设置元素。

    注:必须添加tools:ignore="AppLinkUrlError" ,否则会出错,host值为自定义,scheme值为包名

  • dada配置参考:http://www.cnblogs.com/shenhao/p/5947284.html

通过另一个APP隐式启动

Intent intent = new Intent();
ComponentName cn = new ComponentName("com.tuobang.xsfx", "com.tuobang.xsfx.LaunchActivity");
intent.setComponent(cn);
Uri uri = Uri.parse("com.tuobang.xsfx.LaunchActivity");
intent.setData(uri);
startActivity(intent);