Need to implement socket transmission in Android - android

I need to transfer data(generally text) between two android devices using socket implementation, i.e, the device have to receive the data & also send the data to the other device. Can anyone suggest me some regarding this & also please tell me that, is there any examples regarding this Socket Transmission in Android.

Here is an example demonstrating socket communication between two Android devices.

Related

How to connect two Bluetooth BLE devices in android?

I want to use Bluetooth BLE to receive data from heart rate and send a command to second device. I write two program acccording to android sample(http://developer.android.com/samples/BluetoothLeGatt/index.html).
first program is to use the android to receive heart from A device by bluetooth.
second program is to use the android to send command to B device by bluetooth.
I merge two Bluetooth service into one program. but it seems not work.
i created, one BluetoohManager, one BluetoothAdapter, two service classes,two BroadcastReceiver, two BluetoohDevices. I don't if it is the right way. it seems not work. Does anyone have some code example? or does someone can tell me how to modify the android code example (BluetoothLeGatt) to deal two bluetooth devices?
We have some of the best libraries available for bluetooth communication, this might help you
Bluetooth LE Library for Android
SmartGattLib
android-btxfr
Android-BluetoothSPPLibrary
Android-Bluetooth-Library

Android WiFiDirectDemo p2p connection working as server-client

I test WiFiDirectDemo that is available as Android example, it works as it should. Now this app work as Server-Client. What I want is to work as p2p. Both devices should be able to receive and send data.
I don't know how to achieve communication in both ways?
Any direction in the right way would be much appreciated.
It seems that both devices serves as client and server. And sending messages between is simple, Developer should just implement system for checking and acknowledgment.

How to send file / message between two android device with out any intermediate server

I want to send files between two devices using internet connection with out use any intermediate /server. For example there are two device A and B both have internet connection and both device have installed my application, now need to send a file from Device A to Device B. Device A can know all the detail about the Device B.
Is this possible means guide me in the correct way. Thanks in advance.
You can use a Peer to Peer architecture to achieve this. Basically every phone is a client and a server the same time. See here for a basic implementation.
If the internet is not a prerequisite, you can follow Minav Patel's suggestion and use the Android Bluetooth implementation.
Another solution would be the WiFi-Direct feature (if the phone support it). See here for an example.
You can implement file transfer between two android devices using android bluetooth implementation.Go through following links it will help
android bluetooth implementation basics
http://developer.android.com/reference/android/bluetooth/BluetoothSocket.html
http://developer.android.com/guide/topics/connectivity/bluetooth.html

Getting started with Bluetooth development for Android: Suggestions for test application

I have a task to integrate a Bluetooth device into my application. Now my requirement is very specific. The device has a specific communication protocol which relies on certain ACKs but I figured it would make my development much easier if there was a program that let me test communication with the device.
I was wondering if there was a program for Linux, or perhaps a simple Android program which let me communicate with any Bluetooth device with a series of pings using data I enter and simply log the responses.
EDIT: I might not have been clear enough in my question.
I have a scale that I need to integrate into my application, and the scale has a protocol similar to this:
Get a specific byte string from device
Transfer data
Transfer packet for disconnection
Receive acknowledgement for disconnect packet
Disconnect
Now when I have to issue a POST request from my application, I usually build a test script online so I can test if the POST works properly.
I was wondering if there was something similar I could do with the device.
Thanks
Your question is not clear enough. To communicate with a BT device, you need to know what profile your device supports. Depending on that, you can find a way in Android or Linux or windows to communicate with the device.
The simplest way is to open an RFCOMM channel from android/PC and transfer data to and from the device. For this the device has to support the serial port profile (SPP). If you want to do this in Android, look for the BluetoothChat example from google.
If you want to use a PC/mac/linux look at the Bluez python module. It's really simple to use. There are plenty of other options too..
I was looking for something like SENA BTerm. It lets me connect to any device and send whatever data I wish.
It is an extremely useful tool for testing my code.
http://www.sena.com/download/manual_bterm/overview.html is where you can find it.

How to get two android devices talking through an app on a lan using wifi

I have a small project I am working on and one of the technical problems I am running into is finding a easy way to get one app on one android device to push data to another app on another android device via lan.
I do not want to have to resort to the push API or other similar solutions in case there is no Internet connection.
I was wondering if anyone had any suggestions for this.
Thanks.
You could definitely use Java Sockets. Open a ServerSocket on one device and connect to it using a socket on the other device. You can then send and receive whatever data you want.

Categories

Resources