Android to Android Communication over USB - android

Basically I need to build an APP to communicate between two android devices, send and receive data, in the safest way without Internet.
I could use WiFi, but they are prone to hacks and Jamming. My first question is
if Local WiFi Hot Spot connection could be made fully secured to public?
I am looking into wired communication between android devices using OTG USB serial communication. My second question is
Are there ways to communicate between android devices over OTG-USB using serial ports?

As Android supports both USB gadget and USB host interface, it is definitely possible to make communication between two devices over USB OTG. In this case, your one device will become USB Host which will initiate connection. And the other will become USB gadget device. And you will have to write application considering that.

Related

Communicating with a website via usb connection to a Xamarin.Android app

I have a specific requirement where an Android device cannot have any WIFI/Internet connection. However, the android device can be connected to a Windows machine (that has network capabilities) with an USB cable.
Is there a way to transfer data from the android app(Xamarin.Android) to the Web Application(.Net Core 2 )? Maybe some way for me to hit the controllers via USB connection (Or alternatively bluetooth if this option is not available).
Is there a way to transfer data from the android app(Xamarin.Android) to the Web Application(.Net Core 2 )?
Generally, this is done by certain tool, which enables the TCP transactions between your android device and your PC. ex: Port Forwarding.

Connect Android Tablets via cable/wire

I have 6 android tablets, and i want to connect them via a cable/wire, so that they can send messages to one another. (perhaps similar to way PCs may be networked with each other)
Once connected, apps running on the devices can exchange messages with each other via sockets or any other protocol. What are the best options?
Connecting devices over wi-fi is an option too, but then internet is not guaranteed in this scenario, and devices may be very far of from each other for any near field communication.
You can use usb->ethernet adapters and connect via LAN
Connecting devices over wi-fi is an option too, but then internet is
not guaranteed in this scenario, and devices may be very far of from
each other for any near field communication.
as long as all your devices and server (if any) are on same LAN or simply everything is connected to same hotspot you need not to worry about internet

Connect two android devices via USB

I'm trying to figure out how to connect two Android powered devices,
namely a smartphone (Android 4.1.2) and an android developer
board (Android 4.0.4) with apps running on each, via USB and get them
to communicate with each other.
Right now the developer board is running as the host and the phone as
an accessory. The hosts app is searching for connected devices and is
able to identify the phone as a device, but the app running on the
phone isn't able to find the host.
I've searched the web for quite a while now (!!) but I didn't come
up with anything helpful yet that solved my problem.
For my project it is crucial that I use an USB connection, so please
don't propose that I use bluetooth, WiFi, or anything else...
Regards
USB is host initiated, so it's not surprising that this is not working. Your device that is functioning as the USB device should respond to requests initiated from the USB host. You will probably have to create some sort of vendor specific protocol around this. I don't know what you are trying to do with this connection, but if the device needs to know things on the host you will need to bake this in to your protocol definition and send that information directly to the device.
What you could try doing is using both devices as a host and connecting a USB to UART bridge device between them, then you can transmit data generically in any direction by using the serial connection (through USBManager if the USB protocol is available, or some Android Java Serial class if it is not), plus you don't have to worry about the host-device connection. This would look something like this:
[Android 4.1.2 Device]<--USB Connection-->[USB to UART Bridge]<--Serial Connection-->[USB to UART Bridge]<--USB Connection-->[Android 4.0.4 Device].
Use OTG Cable to interact with your board and phone. Its easily available in the market.

Direct serial port connectivity from arduino to android for data communication

Using Arduino I can get the sensor values logged into the serial monitor over the USB cable...
Is there any way that I can read these values directly on an android tablet by connecting a usb convertor(So that I can tramnsmitt it via GPRS to a server Db)...Please give my some solid directions...
You can do it wired if you use a FT232 or CP2102 converter. Here are a couple apps on the Google Play store that act as a serial monitor.
USB Serial Terminal
Slick USB Serial Terminal
One thing to note is that wired USB communication with Android is not very common, so you may run into some problems depending on the phone you are using. If you want a more guaranteed solution, look into an Arduino Bluetooth module that supports SPP - Serial Port Profile. You can connect the Arduino's RX/TX pins to the Bluetooth module, and have it communicate with the Android device over a wireless Bluetooth serial connection.
Also, here is a similar question on SO, however the answer may have outdated information regarding using the wired solution.
How to make Android and Arduino communicate without a wireless module

Regarding Android Accessory mode and normal usb connectivity

I just started looking into OAPavailable in android.I came accros few doubts
Is accessory mandatory my android phone/table for me to talk to an external device over usb?Cant I talk to my external hardware using normal usb mode?Accessory mode means the phone will always be USB device and my external device will be the USB host.My application in phone should be able to talk to the external hardware regardless whether its a host or a USB device
What exactly are the difference between a USB host and device? Is it just that who powers the bus?When two devices connect how the device say "hey i will be the host and u be the device?"
In short my aim is I want to create an application that can talk to a usb device connected regardless its a usb device or a usb host.Can I acheive it using UsbManager apis without depending on OAP of Android
If you want to be able to work in either situation, you will basically have to write two communication subsystems, one using the APIs appropriate for each case.
It will be the external device and cabling which determines which mode is active (though if the phone cannot be a host, the connection of something external which requires that will be ignored, meaning no communication).

Categories

Resources