Calling a service from an External JAR in Android

允我心安 提交于 2019-12-20 03:33:59

问题


I am trying to call an Android service which is stored in an external JAR file into my android application. When I import the JAR in, everything works fine except the service. If I manually copy the service file into the package and give it a new name, it works, but not when calling the same service by the name it's stored as in the JAR. I have included the package path as well when calling the service. Any help is greatly appreciated.


回答1:


You will need to add the service declaration into your manifest even if it is contained in an external jar.

example:

<service android:name="com.whatever.something.SomeService"/>


来源:https://stackoverflow.com/questions/6700546/calling-a-service-from-an-external-jar-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!