Matters needing attention in the process of using Aidl

1. Avoid the client UI thread to access the remote server method, because if the remote server method is a time-consuming operation, it can be operated many times, and the UI thread will report an error.
2. For the robustness of the program, it is necessary to reconnect the client to prevent the server from accidentally hanging down. There are two ways to do it
The first method: Set the DeathRecipient listener to Binder, and when Binder dies, receive the BinderDied method callback and reconnect the server in the method.
The second method: Reconnect the remote service in OnServiceDisconnected.
3. To improve the security of the server.
First: Use Permission in the AndroidMenifest file in the following way
& lt; uses-permission android:name=”xxxxxxxxxx”/>
Second approach: Permission validation is performed in the onTransact method on the server side

Read More: