I have a feeling this just isn't possible, but thought I'd get some confirmation...
I'd like to have an app which reacts to certain HTTP URLs, and I know I can pre-define a few entries in the manifest something like this:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="example.com" />
</intent-filter>
However, I would like the user to add (or potentially remove) hosts, e.g. add "http://example.net" or deactivate the pre-defined "http://example.com/" entry.
Of course, I can capture such Intents by registering a dynamic broadcast receiver in a foreground Activity.
But is it possible to register new intent filters with the system after installation, so that my app doesn't need to be in the foreground to capture intents which match the newly-added hostnames?
Good question.
Not sure if it's possible but I would:
a) Test what happens when you register the receiver with the registerReceiver()
method inside Context
. Perhaps it gets persisted somehow.
b) Set the dynamic broadcast receiver inside a never ending Service
. (Yep, it's ugly, I know)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With