Wireless (Wifi) Chat Application - android

I am a fellow Android developer and want to develop a similar app like Firechat for educational purposes
I just want to know what kind of packages and techniques I need to learn to develop a app like this
App Features :
I Need to discover the phones which Have wifi direct and my App on
Next I need to be able to send messages and start device to device communication
and If the device I want to connect is not in range ,The message should Hop from one device to another till the destination is reached
I think It can done by creating a mesh network
I have went through similar techonlogies like serval/Firechat/Opengarden ,But I am not being able to comprehend it

For being able to connect devices for peer to peer connection you have the following options:
1. Wifi Direct
2. Bluetooth
3. Wifi Hotspot
Here is a basic tutorial on how to build a chat over wifi direct
http://developer.android.com/guide/topics/connectivity/wifip2p.html
And for bluetooth
http://developer.android.com/samples/BluetoothChat/index.html
You can also import these sample projects in eclipse by:
1 For WifiDirect -
Go to New -> Android Sample Project -> Choose API level 16 (Android 4.1.2)-> WifiDirectDemo
2 For Bluetooth -
Go to New -> Android Sample Project -> Choose API level 16 (Android 4.1.2)> BluetoothChat

Related

Communicate between two (and more) Flutter applications using flutter_bluetooth_serial

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?

BLE Discovering Result different between Windows 10 and Android 6

I'm today in front of a problem with bluetooth and web app.
Introduction
First, here is my goal:
I want to connect a KDC (barcode scanner) in a web application (which will be probably write in C#, ASP.Net Core and JS). You can find the model and characteristic of this scanner here : koamtac.com/wp-content/uploads/KDC300.pdf .
The goal of this project is to use this website mostly on tablet and mobile, and not to use scanner with windows (but we would like to be able to see the website in computer aswell)
Sadly, Koamtac gives a SDK for windows local applications, for Android applications, but not really for web applications...
BLE tool
With this objective in mind, i discovered BLE technologies and the new Web Bluetooth API powered by google : Google Web Bluetooth API Implementations Status.
As you can see, we could use it with windows to discover devices but not to be connect with them. (But with android 6+, it is possible to do both).
This tool seems to be just in line with my project but currently i didn't knew really if my KDC could be use as a BLE device. I decided to make a simple web application where i could test if i saw (or not) the KDC device.
Application
navigator.bluetooth.requestDevice(
{
acceptAllDevices: true,
optionalServices: ['battery_service']
})
.then(device => {
console.log('> Found ' + device.name);
console.log('Connecting to GATT Server...');
return device.gatt.connect();
})
I did it on a github rep to get the HTTPS protocol which is needed to empowered the Web Bluetooth API. You can see this app here : My GitHub Repository
Finally, i tried this application with 3 differents states:
With Windows 10, in local (using Chrome Dev Tool)
With Windows, connected to rlamotte.github.io
With Android 6+ on my smartphone, connected to rlamotte.github.io
Before giving my results, you can see every bluetooth device in range of windows/android on the picture named "Device_In_Range_......" in the Github Rep
Results
I had those results:
In local, KDC device is every time found (see Request_Device_Result_Windows_Local). I can't connect to it (see KDC_connect_Windows) because Windows is not able to connect to GATT.
In this page (see Request_Device_Result_Windows), KDC is found 10% of time, and it takes much time to get it (approx 1 min). As you can see, Request found Gwladys, and 81PRMX1.
(see Request_Device_Result_Android), KDC is never found, and the request found EST (a beacon) and JBL Flip 3 (a bluetooth speaker).
Conclusion:
As you can see, the result of request_device is not the same with windows 10 and android 6. But when we use the bluetooth manager of those device, we saw exactly the same devices (the sum of devices found by each request_device).
I'm new to Bluetooth API area and i don't know why Android doesn't show all bluetooth device with request_device.
THANKS for you help ;)
EDIT #1
It seems that KDC 300 doesn't support BLE. I'm currently searching a way to connect bluetooth classic device to web app. If anyone has an idea you can tell me. If i don't find any powerful way to solve it, i'm gonna try to make an hybrid app android/windows with xamarin to use native bluetooth connection.

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: Establish "Wi-Fi Direct" connection with networked devices

Was going through Android documentation and had few doubts:
Using "Wi-Fi direct" in Android 4.0+, is it possible to establish
connection pragmatically with NON "Wi-Fi direct" enabled network device?
For example, is it possible to communicate with older smartphone (having Android 2.2 OS) with the latest 4.1 based Android Smartphone. I want to use Wi-Fi direct capablities to perform FTP operation on various kinds of smartphones (android, iOS)
Thanks.
I am using an APP named FileDrop which I think has the similar feature set you are looking for.
This is how it works:
4.1 based phone becomes GO and generates a Wi-Fi password to allow older phone to connect to it using legacy Wi-Fi just like connecting to a Wi-Fi access point. You can also use QR scanning instead of manual key-in of the password.
I hope you can get a sample code from them.
Sorry for no real help.

Setup simple bluetooth server console?

Hi i wanna work with some bluetooth communication using my Android device.
How can i test bluetooth connections easy?
Let say im creating a simple application that will send the message "Hello World" upon connection. I would like some sort of server application console i could fire up on my iMac and have my android application connect to.
The server application should just be a console or something that displays all the data it receives and maybe a input to back a response.
Is there anykind of program that allow this ?
Or do i really need 2x android devices to create a simple server / client interaction with bluetooth?
this Android Bluetooth Chat App will be good starting point .
you can make this connect to the mac over serial port profile.
The example above is for the latest Android versions (it is possible to accomplish this with 1.x versions of android also, you will have to use the appropriate api that are supported in older android versions also)
For Programming in the Mac refer to This

Categories

Resources