Should I use android: process =“:remote” in my reciver?

来源:互联网 发布:仅展示三天朋友圈知乎 编辑:程序博客网 时间:2024/06/08 12:27

By defining your receiver withandroid:process=":remote" you basically run your receiver in adifferent process (= VM). For typical use-cases, you don't need to runthis in a different process, and whatever you want to do can probablyrun just fine locally (in your APK process).

The drawbacks of using android:process=":remote" is that you needadditional resources for it to run (in this case a seperate process).When doing so, you're basically dealing with 2 VMs, and some patternslike singletons, static fields can no longer be shared between your appand your remote service.

The benefits of using android:process=":remote" is that for someuse-cases, it might be handy to start a service that will keep onrunning (in its own process) after you've shutdown your application, orif you want remote clients to be able to bind to your service. Yourbroadcast receiver will not block your applications main thread whenrunning in a seperate process upon calling the onReceive method(however, there are other ways of implementing this.

I've found that most of the time, for most common use-cases, you can get away without using android:process="remote"


原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 陌生网友生日叫我发红包怎么办 微信群的群主不小心推出群该怎么办 支付宝验证码被别人知道了怎么办 微信解除银行卡绑定零钱清零怎么办 qq号被盗了理财通的钱怎么办 工行转错账号的钱被冻结怎么办 微信20w限额满了怎么办 通过qq号申请微信被盗了怎么办 微信号被盗手机绑定被改怎么办 腾讯视频激活码兑换达到限制怎么办 虚拟服务购买自动每月扣q币怎么办 微信被骗充值Q币怎么办 微信给别人充q币怎么办 k歌别人送的k币怎么办 忘记了qq号码但记得密码怎么办 q自己的活干完了该怎么办 在应用宝下载的游戏搜不到了怎么办 衣服有图片在淘宝找不到同款怎么办 淘宝卖家小儿说质量不合格怎么办 订单显示显示已签收没收到货怎么办 网上买过的东西查不到订单号怎么办 亚航的组合机票飞机延误怎么办 在微信上面对面红包被骗了钱怎么办 人欠我钱不给我怎么办 微信号被骗走然后骗了朋友钱怎么办 微信手机充值不到帐怎么办 中银香港密码器坏了怎么办 香港恒生银行的编码器丢了怎么办 淘宝拍下订单发货物流不显示怎么办 wish查到仿品审核变慢怎么办 淘宝卖家订单号错误无法修改怎么办 顺丰快递运单号微信扫描取消怎么办 买的王者荣耀号有守护平台怎么办 融e联登录密码错三次怎么办 金融e家u盾密码忘了怎么办 用工行网银转账后想取消交易怎么办 工行融e借没有密码器怎么办 工行融e借密码器丢了怎么办 工行融e联手机登录密码忘记怎么办 领导给员工抱怨工作太烦怎么办 员工抱怨忙的忙死闲的闲死怎么办