Hide android application icon after install

前端 未结 4 1074
傲寒
傲寒 2021-01-31 12:42

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.

相关标签:
4条回答
  • 2021-01-31 13:14

    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>
    

    and if you want to remove it programatically then use PackageManager.setComponentEnabledSetting for removing it from the Launcher as :

      ComponentName componentToDisable =
      new ComponentName("com.xxx.apptodisable",
      "com.xxx.apptodisable.LauncherActivity");
    
      getPackageManager().setComponentEnabledSetting(
      componentToDisable,
      PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
      PackageManager.DONT_KILL_APP);
    
    0 讨论(0)
  • 2021-01-31 13:20

    Just don't implement an Activity with a android.intent.category.LAUNCHER category intent-filter, and that the Service receive boot broadcast.

    0 讨论(0)
  • 2021-01-31 13:25

    use this code

    PackageManager p = getApplicationContext().getPackageManager(); 
    p.setComponentEnabledSetting(getComponentName(),PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
    
    0 讨论(0)
  • 2021-01-31 13:28

    Best Way To Hide Application Icon From Launcher You Can Use <category android:name="android.intent.category.LEANBACK_LAUNCHER"/> In Your Manifest MainActivity

      <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
            </intent-filter>
        </activity>
    

    also add uses-feature

    <uses-feature
        android:name="android.software.leanback"
        android:required="true" />
    
    0 讨论(0)
提交回复
热议问题