sharedUserId 区别 process

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 ownprocessattribute.

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.


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章