Do you need to implement AIDL for a service to run outside of your apps life?
-
30-09-2019 - |
Question
I have a service that will send out notifications with timed tasks. I need this service to run outside the life of the application, but I only need to access the services functions during the lifespan of the app. Is a local service enough or do I need to implement AIDL? Thanks.
Solution
I have a service that will send out notifications with timed tasks.
By this, I hope you mean AlarmManager
and an IntentService
, such that your service is only in memory for the minimum possible time, enough to do a bit of work, raise the Notification
, and go away. Do not write services that attempt to live forever, since that is impossible -- users or the operating system will kill off your service.
Is a local service enough or do I need to implement AIDL?
By asking that question, I believe that you have more fundamental problems, such as not using AlarmManager
and an IntentService
for your periodic work. Your raise-a-Notification
-periodically service should not be running, and hence there should be no "services functions" that you are trying to access on it.
OTHER TIPS
You do not "implement AIDL" - AIDL (android interface definition LANGUAGE) is a recommended but not mandatory convenience/abstration mechanism for generating the code needed to implement a Binder RPC interface, which is the recommended but not only way of communicating with a service.