Open Brileantag opened 10 years ago
Hi,
The plugin does not actually have any way to accept incoming connections, so even though your receiving device is connected to the device that is writing, they are not communicating through a "shared" socket.
As you can see on StackOverflow, you would need to implement an AcceptThread
that would poll for incoming connections in order to receive a socket that both of the devices would know of and could communicate through.
Hi,
i have tried to writte a java Thread
to listen to incoming connections. i faced with a new problem, that is how to get the reference to the BluetoothSocket object on which the incoming connection has been made. I have seen in the plugin code that the reference of the _socket
is obtained when attempting to connect. Do you know if there is a way to get this reference for the device receiving an incoming connection attempt?
Hi,
Thank you @tanelih , i finally found how to modify the plugin after have read the android bluetooth chat source code.
I have added the AcceptThread
, and all is ok.
hey @Brileantag do you have some code to share? im having the same problem but i dont know where to start. Thanks in advance.
Hey @arielgpe , sorry for the late reply. I was not able to use internet for a long period. If still needed, I have a code i could share with you, a small change of the plugin source code. Do you want to have it by mail or should i paste it here?
@Brileantag how it is more comfortable to you? im okay with mails or repos that i can fork.
@Brileantag could you paste the code here or email me? Thanks
Would this code work to connect android 4.4.2 to windows 8.1 pc or yosemite mac os x? I haven't looked at what I have to do on desktop yet.
@coderextreme Hi, the plugin should probably be able to connect to various devices with bluetooth capabilities, such as a desktop pc. You would have to handle the incoming connection on the desktop then.
Hi @tanelih, even I am facing the same problem The devices are paired The devices are connected The connection manager is started on the two devices. The write function ends by calling the success callback but not able to send data, as @Brileantag mentioned I did try implementing the AcceptThread, but was unsuccessful, and need little more Idea on this. Can anyone please guide me on this. Thanks.
@hnthakkar,
This plugin works as a client
of sorts, so it needs a server
to connect to. The problem with the situation you are describing is that this plugin does not implement a server
.
Take a look at this for some guidance on how to implement an AcceptThread
, or a server
in a sense.
Hi! I am facing with a problem when i try to send strings from an Android phone to another one (Sender: android 4.2, receiver: android 4.1). The functions
discover
,connect
,pair
,enable
,startConnectionManager
work fine. Thewrite
one also seems to work good, because theSuccess callback
is called after have written. After that, the device on which the writter is connected is never notified by any data received. Here are more details:I have seen on Stackoverflow that the problem was caused by the fact that i start the connection manager on both devices. Does this still in instance? i have tried to implement the solution given in that post unsuccessfully. Please, how could i turn round this problem?