开发者

Android: Updating Activities on the stack on Push Notification

So, I have an application with multiple activities that can be on the stack. Notably, a list of active Games and an activity showing a particular Game.

When a C2DM message arrives, I currently just show a notification in the status bar, but I'd like to have the GameList or GameActivity update if they are running.

Is there a开发者_如何学JAVA way to get an Application's running Activities? Or is there a preferred way to accomplish this? I saw a snippet of code to fire off events using Intents, should I do something along those lines?

(Or, silly me, this thought just occurred to me: Can I have multiple Classes in my Project receive the C2DM message, and check if it applies to them?)

Thank you.


If you want to update your current activity you could have a receiver within your activity but if you want to update an activity is already in the stack you could make a separate receiver that change some preference value and when the activity displayed you could check this preference to update your activity.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜