Purpose
I need a service thread on the system, which can be bound by my/others apps. The service has to implement an interface and perform tasks like handle the bluetooth connection or similar in a specific reusable manner. In addition a question about the maintainability of the whole thing arises - where i lack of experience
Is it possible to install a service like this on the system? How can it be done without a real membership to a specific application?
Since it is not a really common task i do not found proper documentation (or i simply missed the right tags), so some links could be very useful too!
Ideas
From my research i found following tools which might are suitable:
- Create an AAR library and include it as module in the projects
- Provide a OBB extension
- Create an application which suits my needs and can be started by the other applications (by Intent)
From my understandings none of these can be used really clean in this case and furthermore i dont used any of them before. A small guide through the next rough steps would help me out in case you suggest any of them!
Additional parameter
I would like to hide the sources in case of the use from third party applications which would use my service - dont know if it is possible to lock/separate the two things and use them like proposed, thats why i do not consider this a must have in my case...
UPDATE
AIDL suits my needs. After implementing a tutorial about AIDL i have some remaining questions:
After having a service project and a client project, which are the steps to get it running on the tablet? If i install both as apk's the client still fails to bind to the service. Same if i include the service as module/aar. I dont fully understand the structure of AIDL including the installation process
Is it recommandable to include the service as module in my clients? What happens if i install multiple clients? Do i have make request handling on my service then?
Are shared memory, pipes or similar (which have to be implemented in native?) a real option despite AIDL? What is the preferred way to implement IPC? Or does it depends on the use case?
P.S. Would be great to summarize comments and update together with the answer to my additional questions which i will accept :)