I am facing the folowing problems when trying to pair my Androids BluetoothGattServer and BluetoothLeAdvertiser with Windows 10. My BluetothGattCharacteristics are protected with
PERMISSION_READ_ENCRYPTED_MITM / PERMISSION_WRITE_ENCRYPTED_MITM.
1) When pairing windows, the I have to insert a constant pin "000000". That seams very unsecure compared to the passkey variant that is used pairing the same device with Bluetooth Classic.
2) Android 5 introduced rotating MAC addresses. Windows fails to reconnect to the paired device somehow.
Any ideas? Thanks in advance.
EDIT
Bluetooth Manager is showing "Driver Error" and the Device Manager reports "Windows has stopped this device because it has reported problems. (Code 43)" on this device.
Just reported this Problem to Microsoft and Android.
https://answers.microsoft.com/en-us/windows/forum/windows_10-hardware/ble-pairing-with-android-and-windows-10-unsecure/df711d25-1c3e-4c7a-94f5-e5e6b8bc7a6f
https://code.google.com/p/android/issues/detail?id=250334
Lets see, if it might get solved...
Related
Need advice/help on what I might be doing wrong.
What I have:
Plugged in a HM-10 module to my Arduino.
-Factory Default settings except connection type:
--Using AT+TYPE3 (3:Auth and bond ).
Android LG G4, running Android 6 (Marshmallow) .
Issue:
Bluetooth HM-10 is visible to connect to in Android when searching for Bluetooth devices but when using the default pairing code "000000" "Wrong PIN or passkey. Try again?" message keeps coming up.
What I tested:
Windows 10 laptop bonds with the HM-10 device. (Verified MAC address by running AT+RADD? )
AT+TYPE0 (0:Not need PIN Code ) connects via BLE Scanner app.
Asked three different people with different Android phones for help:
-Newest Samsung phone: Bonds
-Older Samsung phone: Bonds
-OnePlus One phone: Does NOT bond
Hypothesis
Bluetooth library on the devices that cant connect might be lacking handshake protocol when talking to the HM-10 module.
I'm newer of these module HM-10,HM-16, and I meet same problem too.
Finally I found install APP "msmble" in android app store can solve this problem and do some simple test, like send word.
I guess protocol or UUID is the reason, but I don't know the detail.
There's another issue, no matter how I change the PIN setting. msmble always no need to enter PIN code.
Yu-Sheng
I've written an app that scans for bluetooth smart devices, you can pick one from a list, connect to it and exchange some data. All went fine until Android 6.0.
First, i fixed the new permission system so the app requests the location permission at runtime to be able to scan for devices. With that the app worked like it used to, but after turning bluetooth off and back on again the app won't connect anymore but always returns disconnected state with status code 133 in the gatt callback.
I then tried several things:
rebooted the device
re-installed the app
turn off wifi, enable / disable flight mode
checked with NRF master control panel, same issue with same statuscode
This all didn't solve the problem. The only way i was able to get it working again was the option "Network Settings Reset" from the menu "Backup & reset". Both development phones available here (Moto G3 and Samsung S6) feature this option, haven't seen it before Android 6.0.
My question is: are there others experiencing this problem and is there a fix or workaround for this? This could cause a lot of troubles, it so common to turn off /on bluetooth and the problem also appears after been in flight-mode.
Ok, so after a while i tackled this. I was working with NRF ble devices and could not connect but i was still able to connect to TI sensorTag devices.
There were some differences between the advertisements of the devices, some flags were not enabled for the NRF device and also the NRF device had no device name set. After changing this, i was able to connect again. Turned out that devicename must be enabled but can be left empty.
It seems in the Android 6.0 ble stack there is a change in how the connection to a device is made, the device is not connectable anymore if not the right advertisement settings are used after bluetooth is turned off and on again.
Remember Bluetooth has 4 states, ensure to check when it's already ON and not TURNING_ON:
if (intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1) == BluetoothAdapter.STATE_ON) {
...
}
Else you can't connect yet to the gatt server...
I'm stuck with implementing connection between Android Lollipop smartphone and BLE device (TI experimenter board with BLE module). I use following call to connect:
device.connectGatt(context, true, mGattCallback);
I've managed to establish connection for Android 4.3 and 4.4, but when I use this same code for Android 5, I get following error on BluetoothGattCallback::onConnectionStateChange:
onClientConnectionState() - status=133 clientIf=5 device=D0:36:12:CD:73:49
Error code 133 means GATT_ERROR.
I tried to use my own app, google sample and BLE scanner app from play market, but none of them were able to connect to device. I also tried several Android 5 smartphones with no luck.
However, I have another device (TI wireless connectivity development kit), and I can establish connection between it and Android 5 smartphone. So the issue is related to Android 5 and my particular device. I wonder how it can be solved or at least how can I debug this kind of error to find out the root cause.
P.S.
I also tried the approach proposed by #nayoso here, but it didn't helped either.
You may have hit the maximum connection number, see this:
https://www.youtube.com/watch?feature=player_detailpage&v=qx55Sa8UZAQ#t=1712
I have an Android app that I had working a few months ago which I could use to connect my Droid X2 to an ASUS Transformer tablet over Bluetooth. That connection worked fine.
I just finished coding client/server pairs using PyBlueZ on a couple Ubuntu machines, and an analogous client/server pair using BlueCove on a Windows machine.
I thought it would be a breeze to take these three working, tested systems and connect them. Unfortunately, I am currently unable to connect my Droid X2 to my other machines, nor can I connect my other machines to my Droid X2 (I no longer have the ASUS Transformer). I can, however, connect my PyBlueZ client/server pair to my BlueCove client/server pair without issue.
Are there any known intricacies when connecting Android devices to desktops/laptops? Any additional information that must be provided, or differing formats in communication? I'm trying to connect using an insecure rfcomm channel to a service listing. I am using the same UUID on both sides. And, again, I had this exact insecure rfcomm service connection working between my Droid X2 and an ASUS Transfomer.
One interesting aspect is that even though all systems use the UUID, my PyBlueZ and BlueCove implementations also have a service name, but Android does not ask for a service name to connect to a service, only the UUID. Could that be an issue?
Thanks.
The error I was getting was Connection Refused when trying to connect over a bluetooth socket to my other devices. After much pain and research, I found that I could manually unpair my computers from my phone and then the bluetooth socket connects fine.
The strange thing is that I never even paired those devices, so I don't know how they got that way. But if you are getting Connection Refused, see if your Android device is paired to the machine you're connecting to, then manually unpair it, then try connecting with a bluetooth socket again.
Hope this saves someone a few hundred hours...
I a trying to connect my Nexus One with Android version 2.2.1 with my pc and use a terminal program such as windows terminal or hyper terminal to communicate. To do this I believe I need to set up an outgoing serial com port. I have paired the devices. When I go on my PC to Bluetooth -> settings -> "add com port" the android device does not display.
What am I missing?
Does android 2.2.1 support spp? The documentation says it does.
Do I need to root the android to add spp?
Has anyone succeeded in this?
My final goal is to write an android app that communicates with an old school bluetooth device that requires com ports? Getting the android to communicate with the pc is an interim step.
I have tried everything I can think of in my android app to connect to my pc and android device but have not been successful. My android app is essentially the same as Serial over Bluetooth submitted by xCaffeniated but with fewer comments. Any suggestions?
Try beginning with the BluetoothChat sample application. You will then have to alter the UUID used to the generic SPP UUID,
00001101-0000-1000-8000-00805F9B34FB
From this point you pretty much have everything you need.
I have had issues pairing in the BluetoothChat program. So I was required to pair to my computer using the settings menu and then entering the BluetoothChat Program. In BTChat go to the menu and hit connect to a device, choose your computer. I can only speak for windows XP SP3 which is what I'm using. At this point on my machine I receive a task bar pop up asking me if I would like to allow my device to connect as a serial port. I allow it to. Now your phone is associated as the serial port profile on the computer, which you can associate with a specific com port.
Based on bluetooth spec,
http://www.bluetooth.com/SiteCollectionDocuments/SPP_SPEC_V12.pdf,
2.3 User Requirement, "... Any legacy application may be run on either device, using the virtual serial port as if there were a real serial cable connecting the two devices (with RS232 control signalling)." In 4.3 Remote Port Negotiation, "...There is a requirement to do so if the API to the RFCOMM adaptation layer exposes to those settings (e.g. baud rate, parity)... RFCOMM as such will not artificially limit the throughput based on baud rate settings,..."
In my opinion, since Android (2.2) offers no APIs to set up and open a serial port, they may not be necessary as long as you can discover the remote BT device and make a connection to it. I have tried it and it seems working with:
...
sock = device.createRfcommSocketToServiceRecord(myUUID);
sock.connect();
...
where final UUID myUUID= UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"); You may need to take care of Bluetooth Permission and Setup in your application as described in
http://developer.android.com/guide/topics/wireless/bluetooth.html
There might be some issues with the connect() call, i.e. Service is not available or connect is refused, which could be resolved by making sure:
The remote BT device be discovered, and
It must be set to use PIN code (for instance 0000), and
It must be paired successfully with your Android device
These steps must be completed prior to running your application (which has connect call).
Hope this help.
George
There is definitely some funny business regarding how the AT set is implemented on the AOS. The problem is that it is hard to know if you're actually talking directly to Modem or through several abstraction layers (more likely). For a best up-to-date review of the AT Commands available on the AOS platform, plus HW, please see the post:
"How to talk to the Modem with AT commands"
http://forum.xda-developers.com/showthread.php?t=1471241