I created a broadcast receiver. After that in onReceive, I received an information and called a method in the class.
my question is when I call that method I want to call only once but why it calls more than one time?
Are there any way we can determine that onReceive receive only one ???
EDIT
my method that I call in onReceiver is update map location in class extend MapActivity
I also register my broadcast service in manisfest.xml
I want to add comment to the answer but i can’t i don’t know why
how can we determine to our broadcast receiver to receiver only one??
thanks
you can maintain a
boolvariable and when you get call first time in the method, make thisbooltrueand next time before calling the method you can put check there using thisboolvariable.If you are not registering your receiver in the manifest file then you can use this bool value before registering the receiver.