Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I am a web developer and am developing our website on my local desktop machine. I have an android phone (htc desire running android 2.2). I want to test what our web application looks like on android. I can connect to the same wifi network as my desktop machine, however we make use of several hardcoded fake domain names in our web application. On my Ubuntu Linu7x desktop machine I use /etc/hosts to set these domain names to local IP addresses.

Is there anyway to do this on android? I want "foo.xyz" (our testing domain name) to point to 172.31.1.67 (my internal desktop machine). Is there any way to do this without rooting the phone (as my android phone is not rooted now)

share|improve this question
    
How are your other machines resolving that IP to the test domain name? If you're doing it properly and using DNS internally on your network, and updating the IP/name in DNS to point one at the other, then when your phone connects to your internal Wifi it should pick up your internal DNS settings and just work. –  GAThrawn May 23 '11 at 12:49
    
@GAThrawn I do web development too (though not specifically for mobile devices). In my environment it's normal to have a number of local development sites configured in different virtual hosts, and to connect to them via /etc/hosts (or Windows equiv). Since the OP is running Linux, it should be fairly simple to configure a dev DNS server. We're kinda wandering off of this site's subject matter there though :) –  Matt H May 23 '11 at 12:56
3  
@Matt was trying to suggest a better way to do it than changing settings on the phone. I'm a sysadmin, and would much rather have it all centralised in DNS. Hundreds of HOSTS files all over, all pointing different names at different addresses are a management nightmare to keep track of, and a huge headache and nightmare when anyone except the original creator has to any troubleshooting at all. –  GAThrawn May 23 '11 at 13:35
    
@GAThrawn +1 for the 'huge headache' - it certainly is :) DNS is of course a simpler option - added info to my answer about specifying a non-standard DNS server in case that's useful to the OP. My "I do web development" was meant to mean "...so I feel your pain" rather than a "...so I know what I'm talking about" - sorry if it came across as a bit lah-de-dah :) –  Matt H May 23 '11 at 14:33
    
I had a solution to this for a windows machine, which may prompt a Ubuntu solution, unfortunately I lost my step-by-step blog post. Using SimpleDNS I was able to host my own network DNS, so any domain I needed to hit and I had a domain consuming app so it was necessary I just added it and SimpleDNS would forward the IP address to the dev box on the network. Then in Android or iOS device just change your Wifi DNS to the IP address of the box running your DNS and you're away! –  Markive May 23 '11 at 15:24

1 Answer 1

Firefox Mobile supports HTTP proxies, so whilst it's a different rendering engine you should at least be able to get a feel for how your UI performs on a small touchscreen. Here's how to get to the secret config section - http://support.mozilla.com/en-US/questions/758279

The default browser includes proxy support in Gingerbread (although that doesn't help you and your unrooted Desire right now, HTC should be offering an OTA update to Gingerbread soon, or it may spur you into rooting and re-flashing your phone).

(For both of these, you'd need to configure a proxy on your network so that it can serve up your foo.xyz domain)

Finally, you could always use the Android SDK's emulator. Performance will be painfully slow, but you would at least be running the same rendering engine.

Edit: As GAThrawn mentions in the comments above, you could also possibly achieve what you want using DNS entries on your network's default DNS server or a development DNS server. Your phone will pick up your wifi network's default DNS server, or you can change it to something specific via Settings > Wireless & networks > Wi-Fi settings > Menu softkey > Advanced.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.