sharedUserId 区别 process

本文介绍了Android中`android:sharedUserId`和`android:process`的概念及其作用。`android:sharedUserId`允许拥有相同ID并签名一致的应用访问彼此的数据,并可通过`android:process`指定组件在同一进程中运行。`android:process`可以设置应用组件运行的进程,以`:`开头为私有进程,小写开头则为全局进程,有助于减少资源消耗。
摘要由CSDN通过智能技术生成
android:sharedUserId   

              指定appliction 的 user ID。 拥有同一个User id的多个application, 并且使用相同的签名打包:

               1.    可以访问对方data

               2.   可以通过android:process 指定application 的组件运行在同一个process

 android:process

                默认情况下系统为每一个application 创建一个process , 使用package name 作为process 名称。

                通过android:process , 可以指定不同applicaton 组件运行在同一个process ,前提是 user id相同, 而且使用相同的签名打包。

                指定的process 名称 以“:” 开头,会创建一个application私有的process。以小写字母开头,会创建一个全局的process,其他application能与之共享,这样做的好处是减少资源开销。



官方文档连接 : http://developer.android.com/guide/topics/manifest/manifest-element.html#uid
android:sharedUserId
The name of a Linux user ID that will be shared with other applications. By default, Android assigns each application its own unique user ID. However, if this attribute is set to the same value for two or more applications, they will all share the same ID — provided that they are also signed by the same certificate. Application with the same user ID can access each other's data and, if desired, run in the same process.

android:process
The name of a process where all components of the application should run.Each component can override this default by setting its own processattribute.

By default, Android creates a process for an application when the firstof its components needs to run. All components then run in that process.The name of the default process matches the package name set by the<manifest> element.

By setting this attribute to a process name that's shared with anotherapplication, you can arrange for components of both applications to run inthe same process — but only if the two applications also share auser ID and be signed with the same certificate.

If the name assigned to this attribute begins with a colon (':'), a newprocess, private to the application, is created when it's needed.If the process name begins with a lowercase character, a global processof that name is created. A global process can be shared with otherapplications, reducing resource usage.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值