Under what circumstances would using AIDL to define a service interface be the correct decision (rather than just creating an extension to the service
class)?
AIDL can be used between any process in Android: between platform components or between apps. However, it is never used as an API for apps. AIDL may be used to implement an SDK API in the platform, for instance, but the SDK API surface never contains AIDL APIs directly.
The Android Interface Definition Language (AIDL) is similar to other IDLs you might have worked with. It allows you to define the programming interface that both the client and service agree upon in order to communicate with each other using interprocess communication (IPC).
AIDL (Android Interface Definition Language) is similar to other IDLs. It allows us to define the programming interface that both the client and service agree upon in order to communicate with each other using interprocess communication (IPC).
This technique allows you to perform interprocess communication (IPC) without the need to use AIDL. Using a Messenger for your interface is simpler than using AIDL because Messenger queues all calls to the service. A pure AIDL interface sends simultaneous requests to the service, which must then handle multi-threading.
1.when to use aidl based service.
A few benefits can be gained by segment part of your code into backend service:
2.how to create such a service
I have written a good library, you can refer as an example http://github.com/zhchang/hogwarts
You need to use AIDL if you want a class outside of your application's process to access the Service. If you're only using the service from inside your application, you can use a local service.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With