> For the complete documentation index, see [llms.txt](https://notes.tejpratapsingh.com/android-tips/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.tejpratapsingh.com/android-tips/aidl/simple-aidl-communication/create-an-aidl-server.md).

# Create an AIDL server

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.

Steps:

1. Create a service, e.g. `CalculatorService extends Service`
2. Create an Implementation of `ICalculator.Stub`, lets name it `CalculatorImpl`
3. Implement methods:

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

   ```kotlin
    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.
