隐藏的Android应用程序图标安装后,
问题描述:
我见过的,有在谷歌应用程序的地方,安装完毕后,应用程序将没有图标显示尚未将在后台运行的服务的一些GPS应用。
I've seen that there are some GPS application on Google apps where, after installation, the application will have no icon display yet will run services in the background.
我将如何实现这一目标?
How would I achieve this?
答
有关从启动删除应用程序只是没有把这些线,主要活动在的AndroidManifest.xml
For removing Application from Launcher just do not put these lines with main Activity in AndroidManifest.xml
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
如果你想以编程方式删除它,然后使用PackageManager.setComponentEnabledSetting为从启动删除它:
ComponentName componentToDisable =
new ComponentName("com.xxx.apptodisable",
"com.xxx.apptodisable.LauncherActivity");
getPackageManager().setComponentEnabledSetting(
componentToDisable,
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP);