How to communicate from BroadcastReceiver to Activity after instantiating repeating alarm
I am creating a recurring alarm, which I want to be able to communicate with the Activity
that called it. I can send Intent
data over to the BroadcastReceiver
but getting information back from the Activity
at the time the BroadcastReceiver
runs is not immediately clear. I need the BroadcastReceiver
to poll i开发者_如何学Pythonnformation from the Activity
that called it.
I am creating a recurring alarm, which I want to be able to communicate with the Activity that called it.
It is rather likely that "the Activity that called it" no longer exists, because it has been destroyed.
I need the BroadcastReceiver to poll information from the Activity that called it.
No, you don't. You need your Activity
and your BroadcastReceiver
to use a shared persistent data model, such as a database or file, possibly cached via static data members.
精彩评论