-
Notifications
You must be signed in to change notification settings - Fork 669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connections from one Android device to Another #50
Comments
The code to receive a connection on Android not implemented in the plugin. This Android code in the plugin is based on sample in the Android SDK. They have a good example of Android to Android chat. See if you can get something working and send pull request. |
Hello, Is communication between android devices planning on being implemented ? I ask because I need that functionality and don't want to delve into hacking this great plugin unless it's absolutely necessary of course. |
@Fido0101 Android to Android would be nice to have, but I don't think I'll have it implemented soon. If you get something working submit a patch or at least a link to your code. |
@don Hi, is there some news for this? it may be very nice :) |
@ctreton No news on this. I'm concentrating on BLE lately. I plan to allow multiple connections in the BLE plugin I'm working on. |
More info on how this could be implemented #78 (comment) |
I've managed to connect Android devices using Phonegap 2.7, with some modifications to the Java source code. I think there was an error in the code, some lines were turned into a comment, I had to "uncomment" them. Now I'm experimenting with Phonegap 4.0 but couldn't install the plugin yet (using cordova plugin add). |
@tomvanenckevort has a forked version that might work https://github.com/tomvanenckevort/BluetoothSerial |
This version does not work for me.
but again I see the same issue. when I try to connect my nexus 4 to my nexus 5 or vice versa. it instantly says disconnected. Was anyone successful in connecting 2 android devices with https://github.com/tomvanenckevort/BluetoothSerial ? |
I have updated the Java and JavaScript files, these are working just fine. 2015-02-19 18:49 GMT+01:00 tanzeelrana notifications@github.com:
|
Download updated files from here (instructions and final .APK of my test app included): Download the full Android Studio project from here: |
thanks !! @ragcsalo I am going to try this out ..... https://github.com/tomvanenckevort/BluetoothSerial have you tried this app? my last comment was regarding this link above. I tried this and it was not connecting 2 android devices |
No, haven't tried that one. This one I updated myself, and have been using
it to connect Samsung devices for 8 months now... :-)
|
@don Limitations The phone must initiate the Bluetooth connection does that need to be changed ? |
With my modified source files you CAN connect Android to Android. I don't
know how to create a forked version, but will try it someday. :-)
|
@ragcsalo with your updated files the app is forever on discovering devices Are you sure those are the only files that need to be updated ? |
I don't discover devices, I just display a dropdown list of paired devices,
select one and connect. On the second device I also have to select and
connect the first device.... and then can send and receive data. Shall I
make a sample file?
|
If you can zip the project that works for you and share I will try to find the differences in code and figure out what is causing this problem. |
I'll upload the project ZIP tomorrow. :-)
|
Thanks 👍 |
@ragcsalo did you upload the project ? |
Sorry for the delay. I have updated the source files from Hungarian to Download the full Android Studio project from here:
|
Hi, I know this is 5 months old since last activity, but I am trying to send data between 2 Android devices (Nexus 7 and Moto X 2nd Gen) I Can get them to connect and stay connected using the .connect() and isConnected() functions. But when I use the Write() function, I get a success callback that the string was sent, but neither read() or Subscribe is receiving the data. Really not sure what else to try, code is very messy as I have been trying all different things, but I have pasted it below for any advise. I just want to send a string from one device to another the same as you would a chat app, although this isn't a chat app.
|
Can you please help me ?I have tried this bluetooth serial plugin.But i can't able to connect the two android device.Please suggest ,what I need to change in code.I am new to cordova |
@don actually support android-to-android ? ios-to-ios ? android-to-ios ? |
@BurakDev there is no support for that, but you can just take a look at the bluetooth chat example in the official android docs for android to android communication. |
I already uploaded my code, I made Android to Android connection with a
|
Great! :-) I was also experimenting with it, changing a code a little, and now it works well most of the time. :-) |
@ragcsalo Thanks man, you did an awesome job. And thanks for commenting |
My pleasure to help others :-) |
@flockf, is it possible for you to share what you have done to fix the connection problem? Thanks a lot. |
@wang3g If you are simply trying to build the chat demo provided, what does your project's folder structure look like? There must be something you are missing. Did you add the three other plugins? |
@flockf Above is my project's folder structure. The problem I m seeing here is: |
@wang3g if you have not figured it out yet, feel free to upload your project and i will have a look ! |
@ragcsalo Man, is it possible to handle multiple, simultaneous connections with yours? |
@flockf I don't think so... :-/ |
@ragcsalo i just tried to follow ur instruction, but "cordova plugin add https://github.com/jackTheRipper/BluetoothSerial" fails, while "cordova plugin add https://github.com/don/BluetoothSerial" works fine. does this affect the code you've changed? because i get the same problem like flockf. |
Hi, I have the same issue as der1typ. Seems package.json is missing which prevents the jackTheRipper/BluetoothSerial from installing. Any work around known for this? thx! |
@ragcsalo " Download updated files from here (instructions and final .APK of my test app included): Download the full Android Studio project from here: Repo: https://github.com/ragscalo/BluetoothSerial Anyway, My aim is , using ionic2 bluetooth-serial or ionic2 bluetooth- ble , I want to send hello world message from one android phone to another android phone. for this purpose, I prepared an ionic 3 app... |
Thank for your instruction, it works for me, Just a little bug I found, once the two devices are connected, if I try to press disconnect on the device I start the connection, and so press disconnect on the other device, I am not able to reconnect them again by pressing connecting on the first device.
Now Device_01 is unabled to reconnect to Device_02 by pressing Connect BT remote |
@ragcsalo Thanks man for your solution. I downloaded from below link and the apk works great with my android devices. I am able to transfer the msg from one device to other. But when I tried to do this with latest version 0.4.7 this is not working. Its always showing me that 'Unable to connect the device'. I also check the documentation of @dom, and its saying that android to android connection will not work. Is there any solution you have for this? |
I always copy the .java and .js files from one of my earlier projects after I install the plugin. |
Thanks for the quick reply. |
Replacing the .java and .js file worked. Thanks man for the help. |
hey fellas, |
Hello. I try to make the application using the instruction and I do not go out, the devices do not connect. can you help me? I really need |
Hello guys, Download updated files from here (updated instructions and final .APK of my test app included): Download the full Android Studio v3.0 project from here: Good luck! :-) |
@ragcsalo thanks for your work. I've used your solution in a Ionic (v4) project and this is what I had to do to make it work.
|
@longas it says "plugin not installed" as a warning |
@ragcsalo i follow all the instruction but it is not working for me |
I am asking here because I have no other way of finding out about my Problem. Does anyone else of you using this plugin have the problem of sending (writing) data to a remote device (SPP Connection, NOT Android to Android) where messages get lost/replies are somtimes not received? |
Is this still the most up-to-date solution and does it work for capacitor?
|
Hi guys is this solution also applicable on Ionic 6 targeting SDK 31 Android 1, l keep getting error below "Need android.permission.BLUETOOTH_SCAN permission for AttributionSource { uid = 10467, packageName = com.fire.service.app, attributionTag = null, token = android.os.BinderProxy@a208f16, next = null }: Starting discovery." Your assistance will be much appreciated. Below is my environment Cordova: Utility: System: |
Hi @sammy00747, |
I know this was intended to connect with Arduino but it seems like connecting between a pair of android or ios devices could work too. Is this already the case? I fiddled with the examples for a while (using a nexus 7 and galaxy s4) but could not establish a connection.
The examples don't appear to have code to receive a connection in the javascript. Is that only in the arduino logic?
The text was updated successfully, but these errors were encountered: