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
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:
- Common problems of Aidl cross process communication
- Problems in learning Aidl
- What should be paid attention to in socket programming — bind socket error: address already in use
- Points for attention in setting up robot framework + Python 3.7.0 environment
- Aidl learning
- Aidl communication and problems encountered
- Some problems encountered by Android Aidl
- uniapp e. currentTarget.dataset Pay attention
- Duplicate class com.xxx.xxx Find in modules problem solving (Aidl interdependence problem)
- Error executing Aidl: return code 1
- Info:Memory module [DIMM] needs attention: Single-bit warning error rate exceeded, Single-bit fai…
- Solve the problem of Python in Windows environment: Fatal error in launcher: Unable to create process using’”‘ in pip installation
- RuntimeError: Default process group has not been initialized, please make sure to call init_process_
- Error in configuration process, project files may be invalid in cmake compilation
- STOP: c000021a { Fatal System Error } the initial session process or system process terminated …
- A JavaScript error occurred in the main process
- jupyter Fatal error in launcher: Unable to create process using
- A JavaScript error occured in the main process
- BUG: Bad page map in process XXX pte:800000036fae6227 pmd:35be8c067
- The problem of failed to create process occurs in pyinstaller package program of Python