Android ipc LocalSocket vs Binder (AIDL) Android ipc LocalSocket vs Binder (AIDL) multithreading multithreading

Android ipc LocalSocket vs Binder (AIDL)


Are there any downsides when using LocalSocket

  1. There is no security at the framework level for LocalSocket. While you may "want every app to be able to send data to my service", the user may not, which is why standard IPC can be protected by permissions.

  2. startService() and bindService() will cause an instance of your service to be created, even starting a process for you, if needed to handle the request. Your service will not be running all of the time. So, you need startService() or bindService() anyway.


AIDL: Using AIDL is necessary only if you allow clients from different applications to access your service for IPC and want to handle multithreading in your service.

Binder: If you do not need to perform concurrent IPC across different applications, you should create your interface by implementing a Binder.

Messenger: If you want to perform IPC, but do not need to handle multithreading, implement your interface using a Messenger.