Is Android Pass Intent to Activity active only if the activity is already active?

I have a broadcast receiver that I want to transmit to activity, but if and only if activity is visible. I do not want to run it if it is no longer visible. Is there any opportunity for this? Or a way to convey this, but not be active? Or, if you know that a way for activity to register as a broadcast receiver that would also work, I suppose.

+6
android android-activity broadcastreceiver
source share
1 answer

I think you can archive this by registering Receiver in onResume () and unregister the receiver in the onPause () method. That should do the trick.

+7
source share

All Articles