My basic task is to create a native service in android and then write a simple native program to test it. lets say I want to write a simple service which return me sum of tw
If you're creating a normal Android application using the NDK, you can't use Binder because it's not part of the NDK APIs.
Look in the NDK docs/STABLE-APIS.html for the full list of stable APIs, and this thread for an explicit comment by David Turner (the NDK maintainer) that Binder is not a supported API.
https://groups.google.com/forum/?fromgroups=#!topic/android-ndk/1QmVRrNckfM
Your options are:
Service and AIDL facilities of the Android SDK. If you wish to combine this with native code you may be able to call up to Java from native code using JNI.