Android LocalBroadcastManager提高应用安全性
来源:互联网 发布:联想win7还原软件 编辑:程序博客网 时间:2024/05/16 17:36
- 官方文档解释:Helper to register for and send broadcasts of Intents to local objects within your process. This is has a number of advantages over sending global broadcasts with
Context.sendBroadcast(android.content.Intent)
:- You know that the data you are broadcasting won't leave your app, so don't need to worry about leaking private data.
- It is not possible for other applications to send these broadcasts to your app, so you don't need to worry about having security holes they can exploit.
- It is more efficient than sending a global broadcast through the system.
意义是:翻译下,1、你正在发送的数据不会超出你的应用,所以不用担心泄露应用私有数据。 - 2、其他应用发送的广播不会发送到你的APP,所以你不用担心有安全性的攻击。
- 3、本地广播比全局广播更高效
使用方法:非常简单,该类是采用单例,
创建
final LocalBroadcastManager localBroadcastManager=LocalBroadcastManager.getInstance(this);
注册:
IntentFilter filter=new IntentFilter(); filter.addAction("duanqing.test.localbroadcast.fly"); localBroadcastManager.registerReceiver(new MyBroadCastReceiver(),filter);
发送代码:
Intent intent=new Intent(); intent.setAction("duanqing.test.localbroadcast.fly"); localBroadcastManager.sendBroadcast(intent);
0 0
- Android LocalBroadcastManager提高应用安全性
- Android提高应用的安全性, 禁止屏幕截图
- Android提高应用的安全性, 禁止屏幕截图
- 持续提高 Android 应用的安全性与性能
- 持续提高 Android 应用的安全性与性能
- Android LocalBroadcastManager
- Android LocalBroadcastManager
- Android-本地广播提高安全性
- Android-本地广播提高安全性
- 怎样快速提高移动应用的安全性?
- Android应用开发之(小技巧之LocalBroadcastManager)
- 如何提高Android代码的安全性
- 如何提高Android代码的安全性
- 如何提高Android代码的安全性
- 如何提高Android代码的安全性
- 【干货】测试Android应用安全性
- Android LocalBroadcastManager与BroadcastReceiver
- Android 之LocalBroadcastManager
- <C++>获取并显示当前时间
- 进程与线程的简单解释
- 【Storm】storm安装、配置、使用以及Storm单词计数程序的实例分析
- css3的基本颜色构造
- IT人好的学习网点--转载自慕课网 http://www.imooc.com/about/friendly
- Android LocalBroadcastManager提高应用安全性
- python笔记10--urllib模块
- Java内存回收机制
- 快速排序算法java实现
- [ Hadoop | MapReduce ] 使用 CompositeInputSplit 来提高Join效率
- Chromium 清除DNS 缓存的方法
- Length of Last Word
- jQuery 全选 反选 超简单示例
- 安卓微信朋友圈界面