0

I'm trying to programatically allow the USER to decide when to remove my app (a theme which is called from another app) from the launcher.

Currently using a button:

getPackageManager().setComponentEnabledSetting(new ComponentName("com.package.name","Main"),PackageManager.COMPONENT_ENABLED_STATE_DISABLED,0);

Sorry I'm not a coder and I'm doing something wrong, the button shows but no effect even with a launcher or phone restart.

Ideas?

2 Answers2

1

OK, I actually found some other similar code which worked.

I had kept intent.category.LAUNCHER and intent.action.MAIN in Main and moved the intent that calls my app from a parent app into a new class (duh).

Then I run the folowing on a button press by which the user can remove the icon from the launcher (requires launcher/phone restart):

PackageManager pm = getPackageManager(); ComponentName name = new ComponentName(this, Main.class);
pm.setComponentEnabledSetting(name, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
Chandra Sekhar
  • 16,256
  • 10
  • 67
  • 90
0

Why is there even a launcher icon (necessary) in the first place? Does a theme need such an icon?

Apart from that: the same question was asked and answered here: you have to restart the launcher itself to update the icon-list.

Community
  • 1
  • 1
dst
  • 1,770
  • 13
  • 26
  • I've had no icon before but many users get confused that the app won't/doesn't launch and then rate the app poorly - so I want a help page with the option to remove the app at the user's discretion. I realise the question is answered in the topic you linked to, but I've tried that and I can't get it to work. Which si why I posted my code here asking for feedback. – punyweakling Apr 14 '11 at 06:22
  • Sorry, didn't see the remark after the code -.- Does the button-click-event fire and can the package-manager find the Component? (Debugging?) – dst Apr 14 '11 at 06:30
  • Hi, yep the button fires. Not sure if the package manager finds the component. – punyweakling Apr 16 '11 at 00:58