开发者

How to communicate from BroadcastReceiver to Activity after instantiating repeating alarm

开发者 https://www.devze.com 2023-03-29 22:00 出处:网络
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 Acti

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号