AIDL – Android Interface Definition Language is an IDL language used to generate code that enables two process on an Android-powered device to talk using inter process communication(IPC). If you have code in one process that needs to call on an object on another process, you would use AIDL to generate code to marshall the parameters.
Implementing IPC using AIDL
To implement an IPC service using AIDL
- Create your .aidl file – This file defines an interface that defines the methods and fields available to a client.
- Add the .aidl file to your make file. The ADT plugin for eclipse manages this for you. Android includes the compiler called AIDL , in the tools/directory.
- Implement your interface methods – The AIDL compiler creates an interface in the java programming language from your AIDL interface. This interface has an inner abstract class named stub that inherits the interface . You must create a class that extends your interface stub and implements the methods you declared in your .aidl file.
- Expose your interface to clients – If you're writing a service , you should extend service and override service onBind(intent) to retain an instance of your class that implements your interface.