How to remove icon programatically (Android)

Posted by user1865039 on Stack Overflow See other posts from Stack Overflow or by user1865039
Published on 2012-12-05T04:59:13Z Indexed on 2012/12/05 5:03 UTC
Read the original article Hit count: 112

Filed under:

By remove the below intent-filter in AndroidManifest.xml, it can remove the icon after install.

<intent-filter>
  <action android:name="android.intent.action.MAIN" />
  <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

But i have try the below when on Boot than remove the Icon, but the icon still remain after reboot. I have add the permission, and this reboot receiver is work.

public class BootBroadcastReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        PackageManager p = context.getApplicationContext().getPackageManager(); 
        ComponentName componentName = new ComponentName("com.example.remove_icon","com.example.remove_icon.LauncherActivity");
        p.setComponentEnabledSetting(componentName,PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);

    }
}

© Stack Overflow or respective owner

Related posts about android