简体   繁体   English

将远程Android服务导出为jar

[英]Exporting remote Android Service as jar


I don't know if i'm doing it right or not. 我不知道我是否做对了。
I created a service importing the android.jar library file. 我创建了一个导入android.jar库文件的服务。 and then created my own jar of that service. 然后创建我自己的该服务的jar。
Now when i include this jar file in anyother android project, adds its entry in manifest, starts it with 现在,当我将此jar文件包含在其他任何android项目中时,将其条目添加到清单中,并以

startService(new intent(getApplicationContext(),MyService.class));

Nothing happens.It doest not starts and no errors/warning :s 没有任何反应,它不会启动,也没有错误/警告:
What i'm trying to achieve is that: creating a library of my service which i can easily use in many of my other apps or distribute it to other vendors to embed in their apps easily. 我要实现的目标是:创建一个服务库,我可以在我的许多其他应用程序中轻松使用该库,或将其分发给其他供应商以轻松嵌入其应用程序中。 Tell if i'm doing it right or suggest any other way. 告诉我我做对了还是建议其他方式。
Thanks 谢谢

You will still need to add the service to your manifest of the application. 您仍然需要将服务添加到应用程序清单中。

http://developer.android.com/guide/topics/manifest/service-element.html http://developer.android.com/guide/topics/manifest/service-element.html

<service android:enabled=["true" | "false"]
     android:exported=["true" | "false"]
     android:icon="drawable resource"
     android:label="string resource"
     android:name="com.package.name.services.MyService" >
. . .
</service>

If in a lib project or jar, I would try/recommend full package names 如果在lib项目或jar中,我会尝试/推荐完整的软件包名称

Hope that helps. 希望能有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM