Can I define a dynamic intent-filter in my Android application? [duplicate]
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
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);
精彩评论