I can define intent-filter
(s) in AndroidManifest.xml
; works great. Is there an API to register them dynamically? My application allows users to configure "accounts" to various servers; I'd like to start capturing actions going to those servers, but since they are dynamic I won't know them at compile time.
This is what I was asking: Android: Dynamically asscociating data type with an activity
However, since a component can have multiple intent filters, an intent that does not pass through one of a component's filters might make it through on another. An <intent-filter> element in the manifest file lists actions as <action> subelements.
The intent filter specifies the types of intents that an activity, service, or broadcast receiver can respond. Intent filters are declared in the Android manifest file.
description: Specifies the types of intents that an activity, service, or broadcast receiver can respond to. An intent filter declares the capabilities of its parent component — what an activity or service can do and what types of broadcasts a receiver can handle.
This might be useful to you. I use this so my receiver can get a call when the screen off intent happens. this particular intent doesn't seem to work if you try to declare it in the manifest.
IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_OFF);
BroadcastReceiver mReceiver = new ScreenReceiver();
registerReceiver(mReceiver, filter);
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