Java – The NFC API for the Android NDK

The NFC API for the Android NDK… here is a solution to the problem.

The NFC API for the Android NDK

I’m working on a multi-platform project that requires NFC support. The project is written in C++, so it would be nice to have access to the C++ Android NFC API.

Is there a way to interact with NFC using the NDK?

I know that SDK Java methods can be called from the NDK. In this case, I can create a Java class to handle the NFC interaction and then call those methods from C++.

Do you think such a mechanism can be developed?

Solution

You need to use JNI to get it done.

Create a Java class that will access the Android NFC API and provide you with the data in a format that suits your needs. Then access it from your C++ code via JNI call.

Related Problems and Solutions