so i have this problem where i have something to pass back to the activity, but the problem is i don’t know how, i’ve read some threads but its a bit cloudy and confusing, can anyone of your shed some light about this. i just want to pass something back to the activity from my reciever (BroadcastReciever). I have read a thread that you can start an activity but the problem is that there is a bit of a confusion if passing an extra on your intent to an activity is allowed?. Thanks for any inputs any of you could provide.
Share
Possible duplicate answer https://stackoverflow.com/a/6857648/760489
you can do this way by setting flag in intent when you start the activity from broadcast receiver
The FLAG_ACTIVITY_SINGLE_TOP makes sure the apps doesn’t re-open if already open. This means that the “old” intent that opened YourActivity in the first place is re-used and it will NOT contain the extra values. You have to catch them in another method called onNewIntent() in YourActivity.
Check out the complete answer from top link