Android Manifest 中如何声明 Intent Service?
直接的问题:
Android Manifest 中的 IntentService 是否声明为常规服务,还是有其他方法?它试图寻找它,但我找不到答案。
以下是常规服务声明:
<service
android:name=".NameOfService">
</service>
谢谢
Straight forward question:
Is an IntentService declared in the Android Manifest as a regular service, or is there another way? It tried searching for it, but I couldn't find the answer.
Here is the regular Service declaration:
<service
android:name=".NameOfService">
</service>
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在清单中,您使用
android:name=".Communication"
声明服务,这意味着您的服务类应位于com.exercise.AndroidClient.Communication
检查包裹是正确的。注意“.” (点)指的是包的根(即清单中声明的包)。因此,例如,如果您的包是
com.exercise.AndroidClient
并且您的服务类位于com.exercise.AndroidClient.services.Communication
下,您需要像这样声明服务this:或者指定完整的包:
In your manifest you declare a service with
android:name=".Communication"
, this means that your service class should be located incom.exercise.AndroidClient.Communication
Check that the packages are correct. Note that the "." (dot) refers to the root of your package (ie the package declared in the manifest). So, for example, if your package is
com.exercise.AndroidClient
and your service class is undercom.exercise.AndroidClient.services.Communication
you need to declare the service like this:Or specify the full package:
与普通的没有什么不同
这是我的
如果你的不工作尝试类似
编辑
当你进入设置>>应用>>运行服务
将显示正在运行的服务列表。
android:icon 将是缩略图
,androin:label 将是显示文本
Nothing different same as a regular one
Here is mine
If yours is not working try something like
EDIT
When you go to settings >> application >> running services
the list of running services will be displayed.
The android:icon will be thumb image
and androin:label will be the display text