The communication mechanism of the Binder is simple, but some problems have been encountered in the use process. Finally, we have solved the problem. Here we will summarize the problems and share them with you:
1. To use Binder for communication, first define the interface, and then implement the BnInterface *** on the server and the client BpInterface ***. In the end, one is to unpackage the parameters, and the other is to package the parameters.
2. The server must be able to receive the Binder call request with two conditions: one is to implement the Bn interface, and the other is to call IPCProcess ()-"self-> startThreadPool ()
IPCThread ()-> Self-> joinThreadPool ();
These two statements are very important, because he started a thread in the background and was responsible for reading the request called by the Binder interface and then calling the specific interface. If this thread is not available, your service cannot receive the call request, and the client fails to call (died ).
The same applies to clients. To support callback, you must start the thread that reads the Binder call. Otherwise, the callback fails.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.