Android Bluetooth: Service Discovery Failed, connection to Desktop/Laptop - android

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...

Related

Connection refused: ADB connection from Iphone to windows

I am trying to build a watch face for Android wear. The Android wear is an emulator and the device that I have is an iPhone connected via USB to my windows laptop
I have followed the instructions from the below link
https://developer.android.com/studio/command-line/adb.html ,
verified device compatibility as per
https://www.android.com/wear/check/
and have also followed responses as per the answers # adb connection over tcp not working now, however I am receiving the following error
unable to connect to :5555: cannot connect :5555: No conn
ection could be made because the target machine actively refused it. (10061)
Actively refused it means that the host sent a reset instead of an ack when you tried to connect. It is therefore not a problem in your code. Either there is a firewall blocking the connection or the process that is hosting the service is not listening on that port. You may also want to check these SO posts: Trouble debugging android wear over bluetooth - Unable to connect to localhost and No connection could be made because the target machine actively refused it? which also stated that the machine exists but that it has no services listening on the specified port, or there is a firewall stopping you. You may check it out.
Thanks. I was able to figure out with some research that getting to have iPhone with a wearable emulator may not be possible and decided to have both my device and wearable as emulators. Though it was difficult, I was able to get both my emulators talk to each other with the below link Pairing Android and Wear emulators and https://kennethmascarenhas.wordpress.com/2014/08/19/developing-for-android-wear-with-emulators/?utm_source=Android%20Weekly&utm_campaign=a97f04efe2-Android_Weekly_116&utm_medium=email&utm_term=0_4eb677ad19-a97f04efe2-337259209 with a minor change to authentication, which I have included as comment in the stackoverflow post

Socket IO Socket won't connect on Motorola device

I am building an app that uses Socket IO to communicate with a server. I have been testing on an Xperia Z2 running Android 6.0.1. When I tested it today on a Motorola Moto x running 6.0 and the socket won't connect while still working fine on the Sony device. I have searched around and the only suggestion that keeps popping up is to ensure that the Internet permission is declared in the manifest, which it is.
The network is not connected to the internet but the server is running on the network so I don't think that should make a difference.
The Socket is being created using an IP-address and port number that it gets from a service found using Androids Network discovery.
The network configuration is one of two. The only one I can test at the moment is a micro controller device acting as an access point that is running a service and listens for socket IO requests.
What reasons might exist for a socket being able to connect on one device and not on another.

Can BLE peripheral mode trigger the disconnection or refuse to connect?

Here's our situation. We have a machine vending machine run in peripheral mode and mobile runs in central mode. When the mobile is close to the vending machine, it triggers the connection and start to communicate. But as far as I know, the peripheral mode can only connect to one device at a time just considering bluetooh 4.0, so if there's someone who wants to make a trick stands around our vending machine and connects to it all the time, no one else can connect the vending machine. Am I right?
My question is
How to avoid this situation. Is it possible for the vending machine to refuse the connection or to trigger the disconnection when it founds that the connection is invalid (triggered by other app)?
I have heard something like multipoint bluetooth. So how much can the multi be, can it be like 100 so that it may solve the problem.
I found a similar situation in paypal beacon. https://devblog.paypal.com/how-does-paypal-beacon-work/ it says the beacon is running in peripheral mode. I am wondering how do they avoid these invalid connections.
Since, the central device(mobile device) initiating connection, it will act as Master and the other end device(vending machine) will act as slave.
According to Bluetooth 4.1 specification, a slave can have multiple masters.
So, more than one mobile device can connect to the single LE device.

Bluetooth serial connection between Android and Ubuntu

I'm working on an Android application and I have to make a Bluetooth serial communication between an Android device and a Computer with Ubuntu OS. I don't know what to do and how to connect them. I'm looking for good references and someone who can help me.
I made a button which navigates to the Bluetooth settings of our Android device. I don't know what else I should do.
Pair the devices. This has nothing to do with any software, so it has to be done via the phone settings
Once paired, look at 'Bluetooth Chat' example by Google. It has drop in code for connecting two devices. A serial connection is done via Serial Port Profile that is established over RFCOMM. The UUID for SPP is well known, again, you'll find it in the Bluetooth Chat example.

is it ok to connect 2 devices concurrently to connect Bluetooth in Android?

Iam connecting 3G phone for my Android device for internet connection and another Socket(SPP) for CAN signal receiving.Whenever I manually connect to the Bluetooth tethering via 3G phone, i can browse internet perfectly and speed is good.Whenever programmatically connect to the 3G connection, i couldn't browse internet.i checked in shell and observing that in my mobile 'device is connected' message displayed and E symbol appears.No problem for me to connect Socket.But I got problem to use 3G phone.For this iam using APN/DUN mode.I checked both but no use.Is there any performance issue here or anything wrong to connect different devices by using Bluetooth API in android.Why this happends while connecting Mobile programmatically.Please give me guidance.
Regards,
Rajendar
Yes, you can have several open connections at a time.
In fact, I've used my hands-free bluetooth on my phone, as it is connected to my ELM327 SPP device streaming at full speed. I didn't notice any hiccups.
As for losing connectivity when you are connected to multiple devices, it's most likely an issue with the DUN provider you're using.
Also it's worth stating that, on Verizon/3g phones, when you use the phone as a phone, it suspends all 3g data services until the call is terminated.
The way L2CAP defines the LT_ADDR allows connecting devices up to 7. Your connection problems is something else.

Categories

Resources