How to access virtual host in android cell phone - android

I want to access my virtual host (running on my desktop) on my android cell phone and I do not know where to start from. I searched how I can access that. Up till now what I have found is that I need to modify my android's hosts file. I tried to do so but I could not get success. I try to do that with an emulator terminal application.

The host PC can be accessed (from within the phone emulator) using the IP address 10.0.2.2.
That is clearly stated in the Android Emulator documentation.

Related

How do I connect an Android Emulator to localhost server?

I have an ASP.NET/Azure application running on http://localhost:4617. I would like to debug a REST call made from an Android emulator. Related SO threads seem to indicate that you should use 10.0.2.2. I've tried several variations like http://10.0.2.2:4617, but none seem to work. Any other suggestions?
If I do ping localhost on my machine, it returns Reply from ::1: time<1ms which seems to have something to do with an ipV6 address, but I'm not sure how this is related.
If the local host is running on your desktop than that is the problem.
When you type http://10.0.2.2 it tries to connect to the Android emulator local host.
What you need to do is find your computer IP address (you can use google for it). Then once you have it type that into your android emulator browser and it should work
I was able to figure this out. If you're running an Azure server-emulator, then you need to run Visual Studio with administrator privileges. If you don't, then it will not bind correctly to the local host.

How to point specific to ip in android tablet?

I am accessing my local server by using DNS. For this I have made changes into my etc/hosts of my PC. However I am not able to access it through my andoid devices. Is there any way to do it. Please suggest the method. I have also installed windows server 2012.
I have created a virtual host in the server and I need to access the virtual host in My andriod device also
You can use ADB pull/push, assuming your device is rooted.
HowToGeek has a pretty simple step-by-step tutorial

Visual Studio 2015 CTP5 Android Emulator loopback to localhost?

I am using VS 2013 to connect with the new VS2015 Android Emulator. This seems to work now and I can debug, set breakpoints etc which is all fine. (Now, I would use VS2015 but it won't deploy properly -never mind).
I am also developing the server app on my machine and using Fiddler as an http debug aid.. not an uncommon situation I am sure.
The server is running (also under debug in another instance of VS 2013) using IIS Express and I have added bindings to the applicationhost.config so the IISExpress server is visible on my LAN from other PC's and I've checked it is visible.
Try as I might I can not seem to get the Emulator to send the http requests back to my computer.
My javascript uses a servicebase to hold the url:
var serviceBase = 'http://192.168.2.4:64963/'; //'http://169.254.220.177:64963/'; //'http://10.0.2.2:64963/'; //'http://localhost:64963/';
The commented ones show the ones I have tried. None of these works.. the first is the IP of my machine on the LAN, the rest are various ones I have picked up here or the Android dev site.. I have also tried:
http://mymachinename:64963
Because I am bringing both web AND API services from this URL I have also tried a chrome browser on my real android phone (over wifi on my LAN) and this can't get to my dev machine either (where my other pc's can). So I get that it probably can't resolve the names? But really not sure where to go next? I wondered about the Hosts file on my PC but not sure if I can/should set an IP address as a host name? .. any pointers? Thanks, Brett
169.254.80.80 is the localhost loopback.
By going to Additional Tools in the VS emulator for Android (click the >> button on the right hand side) and selecting the Network tab, you will get all the information about the network connectivity.
For the localhost loopback, use the address listed under the Desktop Adapter #2. Desktop Adapter #1 should work as well, which is the IP address of your machine.
I am answering this because I have seen a lot of comments/questions about this topic and need to include some bits that it is hard to fit in the comments.. and I have solved it.
First the solution.. was to delete/replace the vsemu.vhd and vsemu.sdcard.vhd for the emulator with safe copies. This was because in my efforts to fix the problem I assume I had changed some setting in the emulator phone data. Sadly I am not sure what.
However, and this checklist may be useful to someone, before this I was led to it by the fact that because I had web services as well as API from my server URL I was able to test webpage access. This worked on pcs but failed on wifi connected android devices on my network with pc names.. as mentioned in my original question. But it wouldn't work with a numeric IP address either.
I had already added the numeric IP to the applicationhosts.config file of IISExpress, but what I hadn't done, because I thought its on the machine its referring to, was execute the
netsh http add urlacl url=http://192.168.2.1:94693/ user=everyone
command to let it all through.
Once I had done this, I was able to connect using the IP address from a phone, and this led me to discover that the Emulator had obviously got some form of problem. Replacing the VHD's fixed this and I am now communicating.
In case anyone else has this issue using the following IP's worked for me:
IP of the machine
169.254.80.80
However, do remember that VS Android emulator is running in a Hyper-v VM,
So I had to punch a hole in my firewall to allow for my application port to be reached by the emulator.
If your using Web API with visual studio 2015 and VS Android emulator this link helped me out a lot
Use 10.0.2.2, This is the loopback from emulator to your host machine.
See link:
http://developer.android.com/tools/devices/emulator.html
I was having the same issue, but none of the above answers were useful for me.
My BackEnd is a PHP SlimFramework Rest Api.
I decided to change the IP in the auto start of the Slim (was localhost:7888), I tried this: php -S 192.168.43.20:7888, and everything was working fine after I configure the calls to that ip.
I hope this may help someone...
In generic the IP you must consider is the IP of the network you are using/allocated to run the android emulator.
Very raw/rude method of finding it is by going to settings (gear symbol on right panel of emulator, not the one inside) and look for ip address. . Or by opening the ADB Logging window and it's on the top left corner.
Now in command prompt type ipconfig and match the first 3 numbers of IP and that's the network your localhost loopback.
Because in many cases we will have more than one ethernets or virtualbox host only networks are running.
Happy Coding!!

How to use Android OS VirtualBox as device in Eclipse

I found this tutorial on how to run Android OS here: http://www.javacodegeeks.com/2010/06/install-android-os-on-pc-with.html
Has anyone tried to use the set-up as a replacement for the emulator? If so, how did you do it?
I haven't used the guide you link to, but instead downloaded an eeepc image from the Android x86 Project. The steps I followed are:
Install Android to a virtual PC - I used a 64bit virtual machine, enabled all the hardware virtualisation, and used the PCnet-FAST III virtual network adapter in bridged mode - see image 1
Disable host mouse pointer integration - this will allow Android to display it's own mouse pointer so you know where you're clicking.
You need to work out what IP address the VM has, so that you can connect with adb connect <YOUR_VIRTUALBOX_IP>. I do this by logging into my router and identifying the IP of the device that shares the port with my laptop, since that's the Android VM using bridged networking. See image 2.
You are supposed to be able to use VBoxManage commands to identify the IP of the guest, but I've never gotten those working, so the router method is the only one I have that works.
Performance is pretty good - much quicker than running hte ARM emulator, though of course, you can only run Android versions that have been compiled for x86.
You are supposed to be able to use VBoxManage commands to identify the IP of the guest, but I've never gotten those working, so the router method is the only one I have that works.
Hit Alt + F1. when the root#android prompt comes up, type netcfg and press enter. That will show you the IP address. Hit Alt + F7 to get back to the GUI.

How to bridge/tuntap a network device from the Android emulator to the host

Is there a way to bridge the network device of the Android emulator onto the host machine?
I have seen these instructions, but they are really old, the file names have changed, and my attempts to translate them to the current emulator haven't worked. There are a few other similar examples around, but they're all from 2007-2008. I must admit, my Linux- and especially networking-fu are not strong. I could not get a second networking device (eth1) to show up in the emulator.
The reason I want to have the network device appear as a device on the host machine is that I need to be able to connect to the android device from a remote computer (not the host), through rsh (which I've been able to do, as shown in my instructions here), and then use ssh from within to connect to another remote computer. I can get in to rsh, but I can not ssh out (or ping the remote computer). (I've been provided with an image with rshd on it, and this works fine on an actual phone, but the emulator's network devices being hidden is causing problems)
If an eth1 could be created and bridged, that would be great. I'm also open to bridging eth0 (but I'd want to change the IP to 172.x.x.x to be on the same subnet as the remote computers)
Thanks. I'll try to clarify anything if you ask.
1) Download the LiveAndroid iso from the LiveAndroid Project on google code. Or alternatively, download Android-x86 iso from here. 2) Boot it as a virtual machine with VMWare or VirtualBox. 3) Configure your virtual machine to use Bridge networking, as you would per any regular virtual machine. 4) Install Android SDK the other tools like adb onto your Host computer. Connect using adb to the virtual machine as if it were a real android hardware device.
Note: LiveAndroid is an EE-PC based virtual machine. It thinks its running on EE-PC hardware. So there will be no QEMU-based android emulator running. The network bridging will be performed by the Host-OS drivers provided by your chosen virtualization software.

Categories

Resources