(originally asked on GoogleGroup support)
If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans
Desktop OS: Mac
Simulator: none, due to Bluetooth usage which is not available on Simulator
Device: Android phone
Bluetooth device: pedometer
It seems BLE support is unreliable. I turn on my Bluetooth device that I'm trying to connect to (a pedometer), then on the phone I start scanning for the device, and sometimes it picks up, sometimes not. If it does pick up, I try to connect using the address, and I get a "Could not connect to device". (incidentally, if I use isConnected(), it throws an exception saying it was never connected. I assumed it would just return false)
I'm trying to duplicate a native iOS app, which has no issue connecting to the pedometer every time.
I've been searching for a "best practices" on BLE comms, but can not find anything substantial. The link the Cordova docs are cumbersome due to requiring translation into the Codename One lib.
As you mentioned in the https://groups.google.com/d/msgid/codenameone-discussions/b2b022e0-47e3-4a4c-9c33-4998ce2ef65e%40googlegroups.com[thread in the discussion forum] the API is callback based and expects you to wait for a response from the device asynchronously.
This is because we ported a Cordova plugin to implement this functionality in a stable way. Since JavaScript doesn't support synchronous calls those weren't added.
We thought about extending the implementation but we also wanted to keep it as close as possible to the original so changes there can be brought in quickly.
Related
Their website documentation stated that operation is not guaranteed. Was there a known instance that it did work or not? I've seen this product works in IOS Bluetooth and Bluetooth is supposed to be product agnostic. So I don't understand why operation is not guaranteed.
I got the below information from a friend:
Well, it seems the keyboard supports Android just fine.
From this(https://www.amazon.com/product-reviews/B01IP4ENCS) page: "I
held off buying this keyboard for a long time because I read comments
that said it did not work with Android. But that is not correct (at
least in 2019) ... the keyboard works just fine with Android over
Bluetooth. I tested with Android 8 and up, using the app FluidSynth
(which allows you to use downloadable sf2 soundfont files).
The only tip: you must connect to LE Bluetooth from inside the
Fluidsynth app, not from Android's system."
And this(https://pianopenguin.net/best-bluetooth-midi-keyboard/) page:
"This simply means that you can connect it with any Mac, Android or
Windows device that uses Bluetooth."
Therefore, this proves enough that the Korg microKEY Air does work on Android Bluetooth.
I've written a an app and I'm having issues finding a solution to tcpdump data from the Android device running said app.
Android:
The only solution I've found is to root your phone (https://code.tutsplus.com/tutorials/analyzing-android-network-traffic--mobile-10663). Although this is not always possible. There needs to be a way to perform analysis via adb or Android Studio. Unfortunately I have not found a way to do that.
Additionally I've tried PCAPdroid which is an app. This does not seem to be giving me all of the packets I expect to see.
iOS:
Apple provides a feasible solution to create a virtual interface with a connected device where you can then tcpdump all traffic leaving said device.
https://developer.apple.com/documentation/network/recording_a_packet_trace?language=objc
I'm developing an Android application able to connect to a BLE (Bluetooth low energy) device.
Problem is after connection, when I want to re-connect to an other device, I can't.
The only solution is to off and on phone bluetooth.
(On the iOS app, it works so problems is from Android app).
I get this error :
BLE connection generic error
I there any known bug on Android >=4.0 on BLE connections ?
There are lots of bugs in the bug tracker and the documentation and example are not good.
You have not given enough information to really be able to tell what your specific problem is but the main issue people fall over is thinking that because the api calls are asynchronous you can just use them that way. In practice you need to use them in a synchronous manner e.g. wait for one call to finish before issuing the next. I am not clear if this is by intention of just a buggy implementation but it is the case at the moment.
There are definite issues in the underlying framework / drivers as you can get the system into a state where it want allow Bluetooth to switch off, it want work without switching Bluetooth off and on again, it want work without rebooting your phone, it want work reliably with Wifi enabled. If you go through the bugs list you will find more.
In my opinion it's not at beta standard yet but we have been trying to live with it for the past 9 months and Google look to of stopped working on it as far as I can tell from the updates we have had since the initial release.
I know it had been asked many times about connect Ios and android via bluetooth.
I just want to know if android os update to 4.3 and use the bluetooth four-chip,it is any possible for their connection?
I only need receive some bytes from android device,then display on the Ios device.
for now, the answer is no. And I am talking about the newest bluetooth low energy technology.
Since android 4.3, you can now turn your android device into a central, listening to other peripherals's advertisement. However as of today, android 4.4.2, google still haven't realised any public api which allows you to turn android into a peripheral(like a broadcaster). So you can't advertise or send data. Although I did see a page saying you can do it privately, I haven't tried it yet.
http://blog.cozybit.com/enabling-peripheral-mode-in-android-kitkat-4-4/
On the iOS side, in iOS7, apple added new apis and now you can turn your iPhone into either a peripheral or central(not at the same time). So it is ok for inter-iOS exchanges, while android can only listen and receive data from iOS. You can try searching iKardz on the App Store and see how it's done on 2 iOS devices.
http://www.ikardz.me
However, the story didn't end here. Due to some bugs in google bluetooth apis, you can't actually connect to any smart devices for now, for details please see this link.
Communicating between iOS and Android with Bluetooth LE
SO for the record, this limit DID NOT come from apple.
I want to connect my Xbee module to my android phone and communicate with it by sending AT commands.
I do know of the USB host facility provided by Android phones, but I do not know how to send data to it.
I have the java-Xbee API and I am able to talk to the Xbee using my computer but since my project involves using the Android OS, any help on this topic will be appreciated.
According to this Google Code Page, the java-Xbee API requires Java >= 5 and RXTX. Considering those two requirements:-
RXTX on android is not an out of the box lib and may require some hacking which may or may not work.
I'm not a Java VM expert, but i know desktop OS JVMs work differently from Dalvik.How well would Dalvik run code developed for JVM? Here is a nice StackOverflow topic discussing the two.
Faced with the above challanges, are you brave enough to boldly go where no man has gone before?
Could you also consider the following well documented and supported approaches:-
Ytai Ben-Tsvi & Sparkfun's IOIO-OTG
Saves you the headache writing android 3.1+ USB host code and thus allows you to use cheaper phones that run droids 1.5 to 2.3 (without hacking the latter).
Digi's WiFi to Xbee
Allows you to link your android phone (or any other programmable wifi enabled computer) to your device over the internet.