开发者

Redirect BroadcastReceiver onReceive()

What's the correct way (if any) to redirect a received Intent to another BroadcastReceiver?

开发者_Go百科I have two BroadcastReceivers set to listen to the same intent. It works in development, but in production, only the first one registered in the manifest gets the intent.

Can I call the other one's onReceive() method directly, passing the same context and intent? Is there a better way to pass the intent along once the first receiver is done with it?

EDIT - I never figured out how to do this generically, but I came up with a solution. I wrote it up on my blog and it's pretty long so, insert shameless plug to my answer here.


Use an ordered broadcast

http://developer.android.com/reference/android/content/Context.html#sendOrderedBroadcast%28android.content.Intent,%20java.lang.String%29

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜