--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/0f3030ca-963d-4602-9948-fd26f968d26do%40googlegroups.com.
Access to the bluetooth stack from native code is quite difficult. I'd suggest you call out to JNI for that, the Java/Kolin API will be much easier to use.
On Mon, 6 Jul 2020 at 17:38, mac actiaitalia <mac.act...@gmail.com> wrote:
Hi everyone,--
My company has to develop an API library (.so) in C / C ++ on the Android platform. The library can be incorporated into other Apps also written with different Framework (Xamarin, Flutter, Native Java / Kotlin etc.). The library will use to communicate with our external device in Bluetooth (BLE). I have not found an example to start to set up a C / C ++ project and to be able to access Bluetooth from here.
Do you have any suggestions?
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to andro...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/07809b36-6345-45d1-a348-dbec69aeb28cn%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/7836cf9f-6e29-4bec-b28f-74158d9a2944o%40googlegroups.com.
Yeah, if you want a cross platform native library, Qt is a good choice.Nevertheless, you might be making your life unnecessarily difficult by going this route.
As I understand it, Bluetooth access from the NDK is deliberately limited because of the
potential security problems it could call, also Bluetooh is surprisingly complex under thehood.
Qt?There's a QBluetooth API inside Qt which will give you access to Bluetooth through a C++ interface (the Qt signals and slots is required for that to work though). My organization however just called Java methods through JNI.--On Tuesday, July 7, 2020 at 3:38:59 AM UTC+12 mac.act...@gmail.com wrote:Hi everyone,
My company has to develop an API library (.so) in C / C ++ on the Android platform. The library can be incorporated into other Apps also written with different Framework (Xamarin, Flutter, Native Java / Kotlin etc.). The library will use to communicate with our external device in Bluetooth (BLE). I have not found an example to start to set up a C / C ++ project and to be able to access Bluetooth from here.
Do you have any suggestions?
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to andro...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/833a7338-483a-4aa7-b919-b4dfeb8ce002o%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/833a7338-483a-4aa7-b919-b4dfeb8ce002o%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/78d83f77-0476-491b-a998-50952596e4fbo%40googlegroups.com.
ADo you need to also deploy on iOS? Is that why you want to use C++? Is the requirement for cross platform deployment?It's not crazy to use C++ on Android, it's just a bit more difficult.
There's 2 routs you could go:- Make your app GUI in Qt and call out to the bluetooth stack via the Qt JNI bindings- Use bluez and do everything in nativeIf this is something that needs to do weird and advanced stuff with the Bluetooth stack, bluez might be a good option.
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/b2b49b5c-2e27-4289-8ca8-e774912f5099o%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/3ca2edb9-ec4a-4df9-8661-fc95fa9f0f69n%40googlegroups.com.
static JavaVM *_gJVM = nullptr;
static JNIEnv *_gpJNIEnv = nullptr;
extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved)
{
__android_log_print(ANDROID_LOG_DEBUG, "native-lib", "IN JNI_OnLoad");
_gJVM = vm;
_gJVM->GetEnv(reinterpret_cast<void **>(&_gpJNIEnv), JNI_VERSION_1_6);
__android_log_print(ANDROID_LOG_DEBUG, "native-lib", "OUT JNI_OnLoad");
return JNI_VERSION_1_6;
}
extern "C" JNIEXPORT int NativeTest3Wrap()
{
return Java_com_example_testrp1227_MainActivity_NativeTest3(_gpJNIEnv, nullptr);
}
extern "C" JNIEXPORT jint JNICALL
Java_com_example_testrp1227_MainActivity_NativeTest3(JNIEnv *env, jobject thiz)
{
__android_log_print(ANDROID_LOG_DEBUG, "native-lib", "IN NativeTest3");
jclass testCl;
if(thiz == nullptr)
{
testCl = env->FindClass("com/example/testrp1227/TestJavaCall");
} else
{
testCl = env->GetObjectClass(thiz);
}
__android_log_print(ANDROID_LOG_DEBUG, "native-lib", "NativeTest3 1");
jmethodID methodCall = env->GetStaticMethodID(testCl,"test1", "()I");
__android_log_print(ANDROID_LOG_DEBUG, "native-lib", "OUT NativeTest3");
return env->CallStaticIntMethod(testCl, methodCall);
}
package com.example.testrp1227;
public class TestJavaCall
{
public static int test1()
{
return 20;
}
}
To unsubscribe from this group and stop receiving emails from it, send an email to andro...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/207b4f68-76a8-4b00-8e8a-df233317215bo%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/CAP5h4q_f6oSdXYB2YR4Ao%2BfHRX9M3DaUZb9B64MS5Zm%2B17iVNA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/CAP5h4q_f6oSdXYB2YR4Ao%2BfHRX9M3DaUZb9B64MS5Zm%2B17iVNA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/CAEwN%2BMDkmtAEpPyXkXiitV%3DhAEDLpqHXb1qPUOeABAjmRkA7XA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/CAEwN%2BMDkmtAEpPyXkXiitV%3DhAEDLpqHXb1qPUOeABAjmRkA7XA%40mail.gmail.com.
If that's not your cup of tea, then there's an automated way to do it:
https://www.scapix.com/documentation/java_link/
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/CAFcKJqjo3KsW2ZLChTM09PhcfS3105LfwOCardNE1UnAULp31g%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/CAHe7VaOjVFs6Tovymh6m6FFXn%3DNwNT7CQscSzrgAc5-pEAB84A%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/CAHe7VaPsMw90F5iZJVt%3DwCxpo%3DTv2iWkCkzosjE9U%3D9x4sZn6g%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/CAP5h4q9nyDYrQSZr0_EW4cEUC9_gZgj56T6UoOnonEme50BvvQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/CAP5h4q9mpmyQXYku9SRPHHp-jqmrGeoMa99%3Dp3STxCHfvGpuQg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/CA%2BPN%3DMy0QDmVFy1f7XvLKM_GYjXsVos1%3DHHWpozoxKiyygTRXg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/CA%2BPN%3DMy0QDmVFy1f7XvLKM_GYjXsVos1%3DHHWpozoxKiyygTRXg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/CAP5h4q-J84a3K87kP0ZrKpEdEoMzOYFNt4XvoG%2Bzjp8m2TSM6g%40mail.gmail.com.