Hi all,
I have started using custom intents in my application and I have come across a bit of a problem.
When I send a custom intent I register a Broadcast Receiver and I catch the intent no problem.
However problems seem to appear when I send the intent again, the Broadcast Reciever seems to register two events of the intent and so on so if the intent is sent a third time I recieve it 3 times.
This is causing major problems in my application and was wondering is it normal and there is some way I have to deal with it?
Here is my code:
To Send the Intent:
Intent i = new Intent();
i.setAction(SIP_INCOMING_CALL_CANCEL_INTENT);
sendBroadcast(i);
To receive the Intent:
sipIncomingListener = new BroadcastReceiver(){
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if(CallDialogActivity.SIP_INCOMING_CALL_ANSWER_INTENT.equals(action)){
Log.d("SIPENGINE", "CALL CONNECTED SENT FROM INITINCOMINGLISTENER()");
}
};
IntentFilter filter = new IntentFilter(CallDialogActivity.SIP_INCOMING_CALL_CANCEL_INTENT);
registerReceiver(sipIncomingListener, filter);
Is there anyway to make sure the Intent is only fired once??