Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Broadcast 使用指南 #7

Open
zhangsr opened this issue Dec 3, 2015 · 0 comments
Open

Android Broadcast 使用指南 #7

zhangsr opened this issue Dec 3, 2015 · 0 comments

Comments

@zhangsr
Copy link
Owner

zhangsr commented Dec 3, 2015

类型

发送方式 特点 应用场景
普通广播 sendBroadcast() 异步、无序 普通场景
有序广播 sendOrderedBroadcast() Receivers 轮流,可附加信息 拨号广播的拦截、格式化
黏性广播 sendSticktBroadcast() 接收者主动 监听电池状态信息的广播

广播接收器注册方式

  • 动态:registerReceiver()
  • 静态:在manifest 中添加

安全性

使用LocalBroadcastManager,避免其他应用发来的恶意广播,避免内部广播被其他应用接收

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant