Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android NDK and bluetooth

I'm new in android ndk. So, is it possible to work with bluetooth using android NDK (same as in SDK or similar) on not rooted devices. If possible, give me direction where to find more info about that. Thanks alot.

like image 461
Konstantin L Avatar asked Sep 25 '14 19:09

Konstantin L


1 Answers

There is no direct access to Bluetooth APIs from the NDK. The list of available NDK APIs is inside docs/STABLE-APIS.html from the NDK archive.

But that doesn't mean that you shouldn't use Bluetooth from the NDK. You can directly call Java Android APIs and manipulate Java objects from C/C++ using JNI.

JNI calls are quite tedious to do, so in order to minimize these I would recommend you to write all the Bluetooth-related code you need in Java, as a "Helper" class, and use JNI to call this helper from your C/C++ code.

like image 146
ph0b Avatar answered Oct 05 '22 17:10

ph0b