Communicate between two (and more) Flutter applications using flutter_bluetooth_serial - android

I'm developing Flutter app for Android, where I want to exchange some data between few instances of my app on different devices via Bluetooth. I'm using flutter_bluetooth_serial package (this is the only package I found which supports Bluetooth Classic, not Bluetooth Low Energy). I'm able to make connection
between device 1 and device 2 using BluetoothConnection.toAddress(device.address); (but even there was a problem, I had to modify the plugin and apply this workaround to make connection work).
Now I want to run my app on device 2 (which is connected with device 1) and send or receive some data, but I have no idea how I can do that using flutter_bluetooth_serial. In device 1 where I create connection I can use result of BluetoothConnection.toAddress(device.address) to send or listen for some data, but on device 2 I can't use it, because connection is already established by device 1 and I can't see another API for communication.
To simplify: let's say I want to achieve something more or less like Bluetooth chat functionality in this example application, but between multiple Flutter applications, not Flutter app and raspberry pi.
Is there any way of solving it with use of flutter_bluetooth_serial or any other package? Or I have to write some native Android code?

Related

HM10/11 BLE to Android Phone connectivity

First off I would like to ask if it is possibe to send a stream of data from an arduino with HM11 to an android phone via bluetooth.
The data contains ultrasonic sensor's readings, orientation, battery level, etc.
My android phone will be displaying those data accordingly acting as a monitor.
I tried coding already using the android studio using the bluetooth guide resources but i end up unable to connect to my module with a message "read failed, closed or timeout -1". I have tried connecting while paired or unpaired. My app can discover HM11 as well as receive the data using HMBLE Terminal app i have downloaded from Play Store. So I guess the android studio guides are not meant from android to bluetooth modules.
I would also like to begin from scratch as i may have missed out some very important basic information.
Any help?

Android to iOS connect via WiFi or using Multipeer connectivity or using WiFi direct

So I am developing an APP and I need to connect multiple android and multiple Iphone to send text data without any internet connection or service provider data network.
So one of the phone will have to act as a server to relay information between them. But the app will have to decide which phone will be the server and if a phone that is the server leaves the conversation then another phone will pickup as the server this will all be done with some smart programming but before I get there.
I know Android WiFi direct can do a one to many connection setup which makes it easy to connect android phone and accomplish the task between android phone only. But the problems comes when I need to connect Iphone with the android phones. Since the Iphone must be able to act as a server as well.
I would like to know a few things:
Can I connect Android and Iphone via WiFi Direct?
Can I connect Android and Iphone using Multipeer connectivity feature on Iphone?
Is there anyway to create a soft access point using Iphone? I know android can do this via WiFi direct feature.
If non of these can work can you suggest something.
From the discussion here it doesn't look possible
I wonder though if both OS allow enough control over the WiFi transceiver if you couldn't just write an app that could what you are asking and just bypassing the built in software architecture all together. I would think Bluetooth would be too weak except in extremely dense device saturation environments, but just for proof of concept that could be another route to take. My guess though is that you just wouldn't get that level of control over any of the radios inside a phone through the current OS.

Exchange data between google-glass and a android device

The scenario:
I have a android app running my in cellphone. I´m the owner of this app.
I have a google-glass synced with this cellphone. I´m developing a my app for google-glass using the new GDK launch a few weeks ago.
I want to send a data from glass to cellphone and then receive a answer.
No internet connection is necessary, so i´m planning to use Bluetooth to this data communication.
I can create a Bluetooth socket connection, however this will obligate me to manage it.
There is no android high level abstraction that permit me to call a service or a activity directly on the cellphone?
AFAIK, there's no direct pipe between them, the glass is basically a phone with a different set of inputs and outputs. You can create and manage the connection, and it's yours.
AFAIK, there is no other way to do this, as Travis said there's no direct pipeline between them, seems to be true. You can use use BLUETOOTH Chat Application included in the Android SDK.
Just change the input method to voice input in the application
Install that Application in both the devices
Try It
change the code accordingly to send files too.

Inter-device communication via Bluetooth using Phonegap on Android?

I'm wondering if it's possible for a Phonegap-based app on one android device to communicate with another Phonegap-based app on another device via Bluetooth?
If it's possible to do this kind of thing with some native Java code for Android, then it should be possible via Phonegap by wrapping that code up as a Phonegap plugin, right...?
From the Android documentation on Bluetooth, I understand one device needs to act as a server and listen for incoming connections and the other "client" needs to initiate by connecting to the server. This would work in the scenario I'm envisaging with two slightly different apps, a "master" app running on a tablet which controls a "slave" app running on a phone, for example.
This BluetoothSerial plugin seems like it might be useful, as it provides functionality for both listening and for initiating a connection. Has anyone use this plugin for communication between android devices?
Check the following two links hope it will answer your question:
https://github.com/don/BluetoothSerial/blob/e1f1b330747c7c656e567bbd51a568067337e756/README.md
https://github.com/don/BluetoothSerial

Is it possible to exchange messages between 2 android devices through wifi?

I am currently working on the creation of an application for mobile devices with Android which should be capable of sending and receiving messages through local means like wifi and bluetooth. After making a research about it I found out that Android doesn't have a native wifi ad hoc functionality and that the only way to achieve that is through rooting your device and patching the wpa_suplicant and some other similiar methods which are not generic for every device.
Synopsis of what I am trying to achieve:
An application for Android that scans for devices nearby and tries to connect to them automatically. If the other device also got this application isntalled then it automatically accepts any connection request it receives and when the connection is established it sends back a message which ensures that it has this app installed so that both can start exchanging messages automatically and the users don't have to allow/deny any of the sending/receiving in real time.
My questions are:
Is there any way of sending messages through wifi between 2 android
devices without the use of internet?
Since Ad Hoc is not supported, is there any alternative?
In case the answer to 2 is no , then is it possible to make one of
the devices to be an access point so the other can connect to it and
vice versa.
As for bluetooth, is it possible to skip or automate the allow/deny
pop up of an incoming connection and the pairing procedure?
I'll be glad if you could give me an answer to those and/or any suggestions.
You'll be able to communicate between two devices over wifi without a router/access point using Wifi Direct (P2P) in Android 4.0.
Otherwise, I don't believe you can achieve this over Wifi (bluetooth would be the next best alternative). Since 2.2 you can set your phone up to be a Wifi Access Point (for tethering your device's network connection), but during this time, the Wifi hardware is unavailable for normal use. If you had 3 devices it could work (1 AP, 2 connecting to it).
Is this for a constant connection, or a one-off small delivery? You could use NFC if you want to transmit a URL for example (Android Beam integrates this type of sharing in Android 4.0, but could implement it in 2.3).

Categories

Resources