android service配置文件,android manifest.xml配置文件中的 Service节点

android:enabled

指示这个service是否能被android系统实例化。true:能实例化,false:不能实例化。默认值:true。

的enabled属性必须都设置为

true时,service才是可被实例化的。任何一个的enabled属性被设置为fase,service不能被实例化。

android:exported

指示其他应用程序的组件是否可以调用service或者和service交互。true:可以,false:不可以。当值是false的时候,仅有本应用程序的组件或者有相同的USER ID的应用能启动service或者绑定service。默认值依赖于service包含的 intent filters。如果没有包含filters表示能够通过指定sevice详细的类名调用service。这意味着service倾向于仅仅是为应用程序内部使用,因为其他人不知道service的类名。因此在这种情况下,默认值就是false。另一方面,至少有一filter意味着service倾向于为外部使用,因此默认值为true。

这个属性不是唯一的方式限制对其他的应用程序公开service。你也能通过权限限制能与service交互的外部实例(具体看 permission属性)。

android:icon

代表service的图标。这个属性必须设置一个对drawable resource的引用。如果没有设置,用application的icon属性

值代替。

service的icon无论是在这儿设置还是用中的icon,都是service的intent filter的默认icon (查看 the

android:isolatedProcess

如果设置为true,service将运行在一个特殊的进程中。这个进程是从系统的剩余进程中独立出来的,没有任何它的权限。只能通过service提供的API(bingding and starting) 与其进行交互。

android:label

A name for the service that can be displayed to users.If this attribute is not set, the label set for the application as a whole isused instead (see the

The service's label — whether set here or by the

The label should be set as a reference to a string resource, so thatit can be localized like other strings in the user interface.However, as a convenience while you're developing the application,it can also be set as a raw string.

android:name

The name of the

com.example.project.RoomService"). However, as a shorthand, ifthe first character of the name is a period (for example, "

.RoomService"),it is appended to the package name specified in the

Once you publish your application, you should notchange this name (unless you've set

There is no default. The name must be specified.

android:permission

The name of a permission that an entity must have in order tolaunch the service or bind to it. If a caller of

If this attribute is not set, the permission set by the

For more information on permissions, see thePermissionssection in the introduction and a separate document,Security and Permissions.

android:process

The name of the process where the service is to run. Normally,all components of an application run in the default process created for theapplication. It has the same name as the application package. The

process attribute, allowing you to spread yourapplication across multiple processes.

If the name assigned to this attribute begins with a colon (':'), a newprocess, private to the application, is created when it's needed andthe service runs in that process.If the process name begins with a lowercase character, the service will runin a global process of that name, provided that it has permission to do so.This allows components in different applications to share a process, reducingresource usage.

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值