How to remove icon programatically (Android)
- by user1865039
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);
}
}