This project demonstrates how to connect to a remote AIDL service from another Android application.
The client app binds to the server app service and requests a random color.
The returned color is then applied to the Compose UI background.
- Connecting to remote services
- Using AIDL interfaces
- Cross-app Binder communication
- Updating Compose UI using remote data
- Client binds to the remote service.
- Service connection returns the Binder object.
- Client calls
getColor(). - Server returns a random color.
- UI background updates with the received color.
- Android 11+ requires package visibility.
- The client app must declare the server package inside:
<queries>
<package android:name="com.devbilal.ipc" />
</queries>- Always check the result of
bindService()during debugging. onServiceConnected()will not be called if binding fails.- The service action name must exactly match the server manifest action.
- The server package name inside
setPackage()must match the installed app package. - Both apps must contain the exact same AIDL contract.
- Compose UI updates require
mutableStateOf()for recomposition. - Remote calls can throw
RemoteException, so they should be wrapped intry/catch.