I have a library that contains a subclass of the Android Application class. The sub-class contains a method that launches a service (also contained in the library project).
When I include the library in my host application, the activity manager complains that it is unable to start the service intent (not found).
The code structure is:
Libraries manifest:
<service name="com.my.project.MyService" />
Application subclass within library:
Intent intent = new Intent(this, MyService.class);
startService(intent);
I can resolve the issue by defining the service again in the host applications manifest; However, I would prefer not to impose this requirement on developers using the library.
My question is, can I avoid the requirement for referencing the libraries service in the hosts manifest?
NO
At least As Far as I Know. You need to declare it in the manifest for it to be active.
You can register receivers programatically . That you can google out.