Android应用开发:Manifest文件节点andoird:process属性详解

在Manifest文件中Application以及各个组件均可以设置,其含义如下:

1,Application

Google SDK docs说明:

<span style="font-family:Microsoft YaHei;font-size:14px;">The name of a process where all components of the application should run. Each component can override this default by setting its own process attribute.
By default, Android creates a process for an application when the first of 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 another application, you can arrange for components of both applications to run in the same process — but only if the two applications also share a user ID and be signed with the same certificate.

If the name assigned to this attribute begins with a colon (':'), a new process, private to the application, is created when it's needed. If the process name begins with a lowercase character, a global process of that name is created. A global process can be shared with other applications, reducing resource usage.</span>
意思是:应用程序的进程名,所有组件默认情况下均运行在这个进程中,其默认名字为PackageName。可以设置两个APP运行在同个process下,当且仅当两个APP具有想通的user ID并且被同一个私钥签名。若名字以":"开头,意味着APP在运行时可以在必要的时候新建一个process。

2,Activity、Service

Google SDK docs说明:

<span style="font-family:Microsoft YaHei;font-size:14px;">The name of the process in which the activity should run. Normally, all components of an application run in a default process name created for the application and you do not need to use this attribute. But if necessary, you can override the default process name with this attribute, allowing you to spread your app components across multiple processes.
If the name assigned to this attribute begins with a colon (':'), a new process, private to the application, is created when it's needed and the activity runs in that process. If the process name begins with a lowercase character, the activity will run in a global process of that name, provided that it has permission to do so. This allows components in different applications to share a process, reducing resource usage.

The <application> element's process attribute can set a different default process name for all components.</span>

意思是:为这个Activity、Service单独创建一个进程。


总结:

1,可以设置android:process属性使APP的组件运行在不同的进程上;

2,可以设置android:process以使不同应用的组件们可以运行于同一个进程—假如这些应用共享同一个用户ID并且有相同的数字证书;


  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值