This example demonstrates the use of AIDL (Android Interface Definition Language) for exchanging data between Android applications.
AIDL is a language and interface definition format used to exchange data between Android applications. AIDL is used to make remote procedure calls and includes interface definitions for data types, methods, and properties. AIDL is used to facilitate communication between applications that use a Client-Server architecture.
Don't forget you must download AIDLServer.apk to use this example app properly.
This example includes a server application (AIDLServer
) and a client application (AIDLClient
). The client application includes a button that, when clicked, calls the getNames()
function in the server application and displays a random name as a toast message. Clicking the same button again calls the getColor()
function and changes the color of the button.
-
Clone this repository locally or download as a ZIP file.
-
Download the server application using this link.
-
Install and run the server application. The server application runs as a service and will work in the background.
-
Import the
AIDLClient
project into Android Studio. -
Run the client application.
-
Click the button in the client application. The color of the button will change, and a random name from the server application's name list will be displayed as a toast message.
-
Click the same button again. The color of the button will change again, and a random name from the server application's name list will be displayed as a toast message.
-
Repeat this process to see that the color of the button changes each time and that different names are fetched from the server.