Question

I am trying to programmatically add and remove application shortcuts from the app drawer. I understand the app drawer knows which applications should be presented by using an intent filter with the LAUNCHER category.

I would like to be able to add/remove shortcuts to specific activities in my application, according to dynamic conditions, which is why I can't have them simply in my manifest file.

Thank you.

Was it helpful?

Solution

As far as I know, this is not possible. Unfortunately, with the current Android API level there is no way to add IntentFilters to Activity objects through code. Check out this doc on intent filters. Relevant quote:

An intent filter is an instance of the IntentFilter class. However, since the Android system must know about the capabilities of a component before it can launch that component, intent filters are generally not set up in Java code, but in the application's manifest file (AndroidManifest.xml) as elements. (The one exception would be filters for broadcast receivers that are registered dynamically by calling Context.registerReceiver(); they are directly created as IntentFilter objects.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top