In my project IntentExamples, I have this filter, corresponding to a service.
<intent-filter>
<action android:name="biz.rpcodes.apps.intentexamples.START_SERVICE" />
</intent-filter>
In another project, UseExampleService, I have something like:
Intent i = new Intent("biz.rpcodes.apps.intentexamples.START_SERVICE");
startService(i);
...guided by this answer: https://stackoverflow.com/a/16439551/5181778
My question is: How can I best manage these Intent filter Strings across multiple projects? The best solution I have now is to make a class that I am copy and pasting from Service project into the other projects, i.e.:
class ExampleServiceIntents {
public static final String ExampleServiceIntents.START_SERVICE =
"biz.rpcodes.apps.intentexamples.START_SERVICE";
...
While I could import the Service classes themselves, new Intent(this, ExampleService.class)
, I would like to keep the Service classes in their own project.
Service
is not installed. And you can always create a library which contains these constants and then use that library in each project.