8

Is it possible to remove intent filters from activity based on user preference? Say dial intent filter is added and then at later point of time user decides the application should not handle dial.

Edit: Removed add part in question description

dhaval
  • 2,368
  • 9
  • 35
  • 60
  • There is a way to disable Activity. It may not be perfect to remove intent filter, but it can a way to figure out your question. http://stackoverflow.com/a/14142215/1186358 – Kislingk Mar 01 '13 at 21:32

2 Answers2

2

No, it seems they are static.

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.

Source: http://developer.android.com/guide/topics/intents/intents-filters.html#ifs

Felix
  • 88,392
  • 43
  • 149
  • 167
Will Tate
  • 33,439
  • 9
  • 77
  • 71
  • 1
    Thanx for the reference but I was curious with " generally not set up" part. Can we attach and detach from packagemanager? Any chance – dhaval Feb 02 '11 at 05:56
1

I thought maybe you could enable/disable via the Package manager, but despite have a GET_INTENT_FILTERS flag in the PackageManager, it seems it's not supported.

The defect has been raised here, and discussion here.

scottyab
  • 23,621
  • 16
  • 94
  • 105