I am using USB and connect it to the android device and Pc..can I send message from Pc to device and Device to pc?
Please help me
Thanks
The most straightforward way to communicate between an android device and a PC is either to use an Internet service, or to connect the android device to the same wifi access point as the PC and use normal TCP networking methods.
If USB debugging is enabled on the android device and it is connected to a pc with the ADB tool from the sdk, then you can set up an ADB port forward. This will allow the PC to make a TCP connection to the android device, and then bidirectional traffic can flow. However, the port forward does not itself allow the android device to initiate a connection to the PC, though you can accomplish this by setting up tunneling (potential with ssh or some other solution).
Some implementations of tethering (use the android device to provide Internet to the PC) have the side effect of establishing a general network connection between the android device and the PC, at which point either side could potentially initiate a connection. However, it would take some customization to keep the PC from trying to do its networking through the android device, potentially using up your mobile service plan unnecessarily.
Related
So my problem is I want to make an app that can connect to the desktop and communicate with the device in a real production app.... not through usb debugging. In short an app that will connect to a pc and communicate with it either through usb or bluetooth or websocket ports. But I want to do this in a production app, where the user won't enable usb debugging. Kinda like iot
Is there any way i can do so
Is there a way ( protocol ?) to share & exchange files between pc with Windows os and a mobile phone with Android os over WiFi ?
For an Ad Hoc Android to PC connection (Per the source below):
Connect your computer with virtual hotspot created by Android device.
Install any FTP Server app on Android device. It'll NOT give you IP of device for sure.
In your computer, find IP of Default Gateway of Wi-Fi network of Step 1 (In Windows, you can use ipconfig cmd command). Its the IP of your device.
Use any FTP Client software on computer. Use ftp://IP:Port (Port is generally configurable in FTP server app). Enter username & password configured in FTP Server app. Done!
Then they said "After some testing with different settings I got it to work flawlessly, thank you very much. For anyone else looking to do this: I used Android Wifi Tether to start the network using Softap mode, connected to it with the computer, started an FTP server (some server apps might need you to enable 3G mode, even though 3G data isn't actually used, you can turn data connections off if you're paranoid."
Source
For Internet Based Connections:
You may simply want to transfer the files to a hosted server with push notifications to "pull" down the files to the various devices.
Scope this out: http://www.eckstreme.net/
The coder of that app may be willing to help you get off to a better start, email him.
Here are the steps:
Connect your pc and android device to the same Wifi Network. This can be an ad-hoc network created on the android device or your home/work wifi network.
To create an ad-hoc network on your device go to Settings->More (under wireless networks)->Tethering & portable hotspot and tick the portable wifi hostspot option.
Install a FTP server app like https://play.google.com/store/apps/details?id=com.medhaapps.wififtpserver from android marketplace.
Start the app on the device and connect to the URL provided by the app from PC.
Transfer files to/from device from/to PC
In order to learn how other applications connect to internet services I would like to monitor the traffic via Wireshark on my Linux PC. I know there are Wireshark tools for Android, but these require that the phone is rooted which mine isn't.
I have read several places that if the phone and the pc running wireshark use the same wifi connection, it is possible to monitor the traffic from Wireshark on the pc if it is running in promiscous mode.
I have tried that but I can't see any traffic except this:
77 4.638965 ZygateCo_4f:70:27 Htc_b7:a4:78 LLC I, N(R)=0, N(S)=92; DSAP 0xe2 Individual, SSAP 0x36 Response
Apart from these lines (which I have no clue what means) there is no traffic from the phone to see in Wireshark.
Are the further steps to perform in order to have this setup working?
Alternatively, are there other ways to intercept the traffic on a un-rooted phone?
(One way is to setup the pc as an access point and then connect the phone to it, but I have not succeeded in setting up my linux pc (Debian) as an AP)
WireShark monitors only netwrok card on your computer. However, you can monitor the traffic from your phone by using hub. Follow these steps to do this:
Connect your ethernet cable (internet) to the uplink port of the hub.
Connect ur computer that runs wireshark to one of the port on the hub.
Use another port on the hub and connect it to a router that has wifi.
Connect your phone to the wireless router.
run wireshark!
The reason of using hub is because a hub does forward traffic to all ports.
I want to ping the emulator from the server through LAN or WIFI can an one tell the procedure it helps me a lot.
This is not supported.
First, ping is ICMP traffic which the emulator forwards don't support.
Second, the emulator forwards only accept traffic on the host's loopback interface, not its external interfaces - ie, you can only directly contact the emulator from within the PC it's running on.
If you wanted to use a supported format such as TCP, you could write a daemon that runs on the PC and forwards traffic from the external interface to the port on the internal that's then forwarded into the emulator.
Pretty much the only time you can directly contact an android device is when it's an actual hardware device sitting on the same wifi network or LAN as the machine that wants to contact it; not when it's an emulator and not when it's a phone on a mobile network.
I'm developing client/server software for Android.
While connected to the phone via USB debugging, I'd like to access the webserver I'm running on my developement PC - using the USB connection.
Is that possible and if so, how ?
I stumbled upon the answer after a night sleep.
Enabling USB tethering on my phone (N1, 2.2.1) gives it and the host computer an IP address. The phone can communicate with my web server running on my developement machine!
(Chris, the rumors are right)
Just make sure your web server is listening on that IP address. For apache, use the line
Listen 80
or
Listen x.x.x.x:80
(x.x.x.x being address of your android tunnel)
The easiest way to do it is via wireless. If you don't have wireless, I'd say bite the bullet and get it, it's going to be a necessity for testing anyway :)
Typically the USB only supports connections from the development machine to the phone (via adb port forwards) and not the other way around. Of course once a connection is created data can move bidirectionally. One could use this to build a tunneling proxy web proxy (one connection in from the development machine to a daemon running on the phone, outbound connections from the phone then tunnel through this)
I have heard rumors though that what you want to do - often called reverse tethering - may be supported in some more recent devices.
Kevin's wifi suggestion may be the simplest with a real device.
On the other hand, unlike typical phones, the android emulator can directly access the development machine's loopback interface at an alias address given in the documentation.