0

I have a C++ library which helps in establishing communication to a POS terminal over LAN and serial port, now i want this library to work on android phone only over Bluetooth medium,

If there are native APIs for Bluetooth communication in android, I can port this c++ library to android and write a java application which will use this library through JNI

Are there native APIs for Bluetooth in android, if so where do I find the documentation?

4

1 に答える 1

3

I looked at this general issue (java vs. native Bluetooth on Android) a while ago and eventually concluded that the native API did not provide any extra functionality relative to the Java API - so there was no advantage for me in going native for Bluetooth.

And the Java Bluetooth API, which is well documented, is actually quite limited compared to what you might expect coming from e.g. desktop Linux, Mac, or Windows. You are miles away from the HCI. The point being, that you may well find that the API's required by your library are not available on Android (unless it requires little more then RFCOMM sockets).

If the Android Bluetooth API's do meet the requirements of your library, then yes, you can access them from native code so you could port your library.

Caveat: when I looked at this I saw that devs are strongly advised away from native, so I have not done any native on Android and am only reflecting what I read.

于 2012-10-04T15:24:18.830 に答える