This paper studies the implementation of binder service and wants to write a binder example.
On the Internet and books have seen similar examples, according to write, found that they are not what they want, not quite in line with the style of the source code.
Streamlined one from the binder service of the source code.
Problems encountered:
1, frameworks/native/include/binder/iinterface.h:50:error:undefined reference to ' android::refbase::~refbase () '
Reason: No add only added Libbinder library, not add Libutils library,
2, ITest.h TestService.h header file where to be included.
I put it on the Framework/av/include/media.
Only include <media/ITest.h> can be quoted.
But can you put it in any directory of your own definition? such as:./test/include/test/itest.h
#include "ITest.h" compilation does not find the header file. You also need to specify the header file path in Android.mk
Local_c_includes: = $ (Local_path)/. /include/test can be.
3, my example print log is used Aloge and so on. There are loge in the code base
Write an example: Despite a few lines of code I also toss to two or three days. See will, never necessarily will, hands is the reason.
Code View address: Https://github.com/langxianwen/binder-demo
git path: Git clone https://github.com/langxianwen/binder-demo.git
C + + Layer implementation Binder Service example