Create an AIDL server

AIDL server app exposes an service.

An AIDL server is an app that does the actual work and sends back the result to requesting clients. One service can connects with multiple clients via Binders.


  1. Create a service, e.g. CalculatorService extends Service

  2. Create an Implementation of ICalculator.Stub, lets name it CalculatorImpl

  3. Implement methods:

     object CalculatorImpl : ICalculator.Stub() {
         override fun add(a: Int, b: Int): Int {
             return a + b
  4. Expose your stub implementation with a service binder:

     class CalculatorService : Service() {
         override fun onBind(intent: Intent): IBinder {
             return CalculatorImpl

Now your service is ready to be consumed by your clients, now let's create a client application.

Last updated