Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing intranet in Android emulator

I'm trying to test an intranet site in the Android emulator, but I can't seem to get the emulator to access our intranet. For example, the site I'm trying to access is at http://compass/messages, but trying that page in the browser gives me a Google search result page instead of the intranet site.

I can access the INTERNET with the emulator, but not the INTRANET. I can access the intranet from the host machine, and from the iPhone simulator on the same machine.

I'm assuming there's some sort of weird command line thing I need to do, but I'm pretty clueless...any ideas?

like image 424
Richard Avatar asked Oct 20 '10 16:10

Richard


People also ask

Can you connect to the Internet on an emulator?

If your emulator must access the internet through a proxy server, you can configure a custom HTTP proxy from the emulator's Extended controls screen. With the emulator open, click More , and then click Settings and Proxy. From here, you can define your own HTTP proxy settings.

How does Android connect to Internet resources?

String link = "http://www.google.com"; URL url = new URL(link); After that you need to call openConnection method of url class and receive it in a HttpURLConnection object. After that you need to call the connect method of HttpURLConnection class.


1 Answers

After a tremendous amount of searching with no answer, I was able to access my local dev server by substituting the domain with the ip address. For example, instead of:

http://compass/messages

use this (with your server's IP address)

http://172.33.22.1/messages

It works in the Android emulator browser, and also from a WebView in the app in the emulator. I don't know why this works, but it does for me. Hope it helps someone else.

like image 155
Adrian Carr Avatar answered Sep 22 '22 17:09

Adrian Carr