How to communicate with Android from a PC via wi-fi? - android

I want to write a program ,which will communicate to the available android mobile device via wi-fi .(Note :I do not want to use the USB cable)
That moblile device is having an IP in it by a wi-fi connection with it.The major thing is that i pinged that IP and I am getting connection packets getting back to my pc,means I can communicate with the devices. so can I able to get the details of the device.
details means
1.its name what user sets on it.
2.some address like mac in computers.
3.model name.
4.type of os in it.
etc
I really find this interesting but,no idea how to do but i got something like ARP protocol for getting the mac address but I do not know how to communicate with a phone with this ARP protocol.
Can we communicate by the SSH as it a linux kernel based OS .Kindly give me a way how to get these information.
can any one have some idea ,kindly tell me,it is very important for my project.
Thanks

There is adbWireless application. If you install it on your device, a widget appears that allows you to connect with it over WiFi. In Toast message it shows IP address of Android device.
Then on your PC type:
adb connect 192.168.1.102
(replace it with Android IP address).
And now you have an access to your phone over WiFi (check it with adb devices).
You need rooted phone to use adbWireless.

Related

I cant access my localhost using my PC ip. For Our mobile APP

Can someone help me we have a mobile app for our capstone project i ask my friend to make it(I don't have knowledge for android developing) but i'm the one who make for our web app.he added a variable to enter hostname .the problem is my friend test it it connected using ip/CapstoneFiles ->(Foldername codeigniter). but when i try it it won't connect using IP/CapstoneFiles. i already disable my firewall and antivirus.. My pc is connected to Prepaid wifi via wired connection and i connect my phone via wifi
if you are using windows you can get IP by command ipconfig and for linux it's ifconfig
Change the IP wherever used in the project with current IP you're getting by command.
Your PC and Phone should be connected to the same network.
See if you are running it at //localhost:8080 port then use URL = "http://10.0.2.2:8080/" in your android app to access the server as this translates to localhost for the application
As you must know your application has its own pid and ports within so you will be required to use this
let me know if unclear

Android device and xampp server connection

Is there any method to access the android app database from xammp server using android device using only usb cable and no other mean, like wifi and mobile network.
I have gone through many articles and forums to find out this problem but haven't find anything helpful. I am trying to connect the database on localhost xampp from android device (Samsung Galaxy s 2) through my app. I have tried
127.0.0.1
127.0.0.1:80
127.0.0.1:8080
10.0.2.2
10.0.2.2:80
10.0.2.2:800
also tried my laptop ip address.
When i try to debug my app from eclipse on device, the app starts but when i click to get data (product list) from localhost the device just say that "unfortunately Myapp just stop working" and app is closed. This is when i am not using wifi on my device, but it works well when my device is connected to wifi. May be there are places when there is no wifi so in case usb option will be good.
install xampp
start Apache on computer where is installed xampp
run cmd.exe (menu
start -> run ...)
enter command: ipconfig
IpV4 Address is that what you need.
Input in android device's web browser the IP address (example: 192.168.0.23)
You will see xampp menu.
I'm don't belive this will be possible very easily since this would create a security risk for the pc (immagine somone charging his phone on your pc - and he's then accessing your pc just because its connected).
however, after a quick search i found that it might be possible using something called "reverse tethering" - also, it appears to be possible if the pc is running linux.
The problem is that your phone and the laptop have to share a network-connection together, otherwise localhost or any Laptops IP-adress won't be accessible. Maybe you could create an AP for your laptop (therefore connect your pc via Wifi to your Phone) - then the pc's IP-Adress should be accessible?
Maybe this Article will help you further...

Sharing Files Between Windows and Android over WiFi

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

How to access a computer from a USB-cable-android-connected device?

I am trying to deploy and test my application on an android device which is then connected to my laptop with a usb-cable. Now, how can I target a webapp deployed on my laptop ?
knowing that my wifi is down and that I don't have the right to change router configuration to do some IP port forwarding tricks (in case you would like to suggest me to use the mobile network e.g 3G, go on internet and get back in via our router external IP address ==> which is also a little bit heavy given what we want to do here)
According to the android documentation, "the emulator" can use the ip address 10.0.2.2 to access the hosting computer but there is nothing for devices...
thanks in advance guys,

TCP connection from phone to debugging host

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.

Categories

Resources