How to connect two Android devices over GPRS or 3G? - android

I want to connect two phones over 3G or GPRS to send a stream of data continually. One phone will act as client that will send data and the other phone will act as the server to receive and display the same data. Is it possible to stream data without using a server?

No. You will have to use some kind of server definitely.

Not really, I have been working on a similar project using TCP/UDP packets, but the big issue is with finding the other phone.
The best way is to use a system similar to O-Auth to connect with an external server on the internet
and send/recive data through that, but I don't have much experience with that.
My project used UDP to find a server on a wifi network and get its ip, then connect to it through tcp,
but you just as easily use a server on the web to do it over any mobile data connection.
If you wanted I will gladly send you some of my tcp code as a starting point.
Swift

You can't connect two devices directly though the cellular data. You need an intermediate server.
If on the other hand you are going to connect them through wifi, then you can use sockets to connect both of them together.
If the distance between both the devices is less, then you can also try out transfer over bluetooth.

Related

(Android) How to establish peer to peer connection via internet given each device's IP addresses

I'm trying to send a chunk of data (about 1mb) from an android device to another via internet. Lets say I can get each device's IP address and open a specific socket before making the connection.
I have successfully making this connection via Wi-Fi Direct, however the distance between each device became an issue. Therefore, i need to use internet connection. I hear that WebRTC could make such connection, but it needs me to use STUN/TURN server to get other party IP addresses (which I can get without server).
I expected to have this connection pure peer to peer like Wi-Fi direct (without any use of cloud server). If a server is needed i could make one of the device act like the server.
If anyone could provide me some example of code of how to do this in kotlin, that would be much appreciated.
Thanks!
Try out WebRTCs apprtc demo. There are instructions on how to get and compile the code here https://webrtc.org/native-code/android/
You should be able to see how a data channel is established and how to send/receive that data.

How to send and receive Data between Devices with Flutter/Dart?

I would make an app to play with playing cards.
To make this app:
I must send and receive data between devices.
I would make it with mobile hotspot, so that all devices are in the same wireless network, also without connection to the internet.
How can I do this with Flutter/Dart? Any ideas? Or better with bluetooth? Or with internet connection?
I think that a way of doing this is with mobile hotspot, by using the UDP protocol of communication between devices through a local network.
There is a class in a flutter that does what you are looking for, just search for send and receive via UDP in flutter and you will find a lot of ideas, projects, classes, and packages.
Is P2P communication between devices a hard requirement for you? Otherwise, Firebase real-time database will be an easy solution for you. This will require internet connection.

Transfer Data over wifi in android between server and clients

How can I do these steps in android (Eclipse)? In a simple example. I am beginner.
For transfer data over wi-fi.
Server device opens a socket and listens on it.
Server device broadcasts the local IP and Port it's listening on.
Client devices receive broadcast and initiate a connection.
Transfer data between server and each client or clients and server.
This is very broad and would require a lot of code to show, and therefore I recommend viewing
http://developer.android.com/guide/topics/connectivity/wifip2p.html
WifiP2P is very cool, but can be tricky to setup. If you want to start playing around with wireless communication you may want to look at the BluetoothChat Example.
Bluetooth and specifically Bluetooth Low Energy are emerging as the standard communication protocol for Internet of Things. If you want to start digging into what you can do the example should work right off the bat with the latest version of Android Studio.

Receiving data through wifi connection

I'm trying to make the following work, and wonder if it is possible:
I want to send data from a hardware piece to an android device. Although the hardware only has an Ethernet connection available.
If I were to make an Ethernet connection from the hardware piece to a router, and then communicate from the router to the android device with WiFi, is there any way I could tell the android device, just receive data from the WiFi?
Using IP protocol will allow you to communicate over any IP network.
Easiest way to do that is using TCP sockets that uses Server/Client relation to communicate.
I'm guessing you are using a microcontroller (arduino?) if that is the case there are many IP labraries and examples you can look at.
after writing the server code on the hardware then you can easily use sockets to connect to it from android, here is an example on how to connect android client to TCP server.
TCP Client tutorial
Extra links:
TCP on Wikipedia no need to read the implimentation details just understand the concept.
Java All about Sockets Great overview of socket programming and should get you ready to write effective code on the android side.
LAN wikipedea article about LANs

Transfer data between two Android using Wifi

I'm trying to develop an Android application which have to be able to transfer data/message between two Android mobiles, as a client server connection using their own Wifi, which having no network or routers nearby. I just tried using Tcp program to do this but it fails, its not connecting, I'm getting ConnectException and connection refused.
[Edited] Is it possible to achieve this using Android Portable Hotspot integrated with application? Is there any tutorial regarding this approach?
Any Ideas, how to do this?
Thanks.
You need to get the two devices networked to each other before you can worry about tcp usage of that network connection.
If one device is willing to perform access-point like functionality as part of a portable hotspot, and you select that as a wirelss network on the other, you may achieve a network connection between the two that can be used for custom traffic. Though there are ways the hotspot could be implemented where that would not work. Also of concern, the "client" device will now be sending all of its network traffic through the hotspot device, including not just foreground apps but anything it decides to do in the background.

Categories

Resources