• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

broadcastReceiver registration in activity class programmatically

m.murad

Lurker
Hi everyone,

I want to register onReceiver() in activity class, I have done it as below, in myActivity class, but I could not call onReceive() in broadcast, don't know why? and where i m wrong?
I have called it, when i register it in manifest.xml, but I want to call/Register it programmatically. Because I want to call it as many times as I require.... Please any one help ASAP?


static final String SOME_ACTION = "android.intent.action.NEW_OUTGOING_CALL";

filter = new IntentFilter();
filter.addAction(SOME_ACTION);

this.closeReceiver = new BroadcastReceiver(){
@Override
public void onReceive(Context context, Intent intent)
{
showSuccessfulBroadcast();
}
};
registerReceiver(this.closeReceiver, filter);
 
Back
Top Bottom