There is some BroadcastReceiver , which is registered in the onStart method of onStart and deactivated (unregister) in the onStop method.
There is a service that sends an intent that should catch the given BroadcastReceiver and output data from it to the activit, of which the class is a field.
If the service sends an intent when the screen rotates, that is, when the receiver is deactivated, but not registered yet, then the data from the service will not reach activation (a similar situation will occur if the application is banal-minded during the download).
Tell me, please, how to handle this situation correctly.
Ps. Maybe in this case any other way of communication between the service and the activation will work. To be more specific and simplify the task, it looks like this:
In the activation, we press the button, the service starts, which downloads the text from the Internet and gives this text back to the activation in which it is displayed. The main goal is to deliver data from the service to the activation.
The task is quite common, I am sure that many have already solved it, but for some reason I cannot find a good solution.