我已经看到Google应用程序上有一些GPS应用程序,安装后,应用程序将没有图标显示,但将在后台运行服务.
我怎么做到这一点?
解决方法
要从Launcher中删除Application,请不要将这些行与主Activity放在
AndroidManifest.xml中
<intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter>
如果你想以编程方式删除它,那么使用PackageManager.setComponentEnabledSetting从Launcher中删除它:
ComponentName componentToDisable = new ComponentName("com.xxx.apptodisable","com.xxx.apptodisable.LauncherActivity"); getPackageManager().setComponentEnabledSetting( componentToDisable,PackageManager.COMPONENT_ENABLED_STATE_DISABLED,PackageManager.DONT_KILL_APP);