I have I have two applications. I have a menu button on one application (service A) that is used to trigger an action in a different service (service B).
I want to make the menu item (service A) visible only if a file is present in service B.
Is there a clean mechanism for achieving this, rather than using absolute paths with File?
There are two ways to achieve this:
Use remote binding across services. You’d need to define an interface using AIDL and then invoke methods on the interface to delegate the responsibility for checking if the file exists to service B.
Define a ContentProvider in the application that “owns” the file and query the content provider to see whether the file exists or not.