How to access a URL on port 80 via android browser - android

my android device cannot access a URL:
http://myip:8080/alias
I tried another port of my service (80, running a service apache too) and works!
The tests, i'm doing from web browser of my device.
From my computer (on same network), both URL works!
The problem like a firewall. I cant access a port different of 80.
Thanks,

It's likely that the problem is related to your web service rather than your android device, as you should be able to access pages on non-80 ports without any issue.
Have you tried using fiddler or another debugging proxy to check the response from the server?
If not, this may be useful
http://fiddler2.com/documentation/Configure-Fiddler/Tasks/ConfigureForAndroid
Edit: also, you mention that you can view it on port 80 on your android device, perhaps try disabling your firewall on your PC?

Related

How can Android Emulator reach server on local network?

I want to connect to a server on my local network (10.134.0.178:80). The ip address of my machine is 10.134.3.12 and the ip address of the emulator Wi-Fi is 192.168.232.2.
Now I found out that you have to use 10.0.2.2 to connect to a server on your local machine. But the server isn't running on my local machine - instead it is a separate instace on my LAN.
My local machine can reach and ping the server without problems. The emulator not, but the emulator has internet access. So I can access e.g. www.google.com.
How can I connect the emulator with the server? The shown redirection rules only apply on port level. So how is this meant to be used? Other solutions only talk about a local server. Only one is talking about a similar case, but this is not working for me (no connection)
netsh interface portproxy add v4tov4 listenport=80 connectport=80 connectaddress=10.134.0.178
Additionally, I have to switch server instances (different ips/ports/addresses). So how can I use the Android Emulator in this case? To which address should the webservice calls be made? 10.0.2.2 or 10.134.0.178?
Hmmm, well, your Android app should connect to the server's address/port as it appears to the host machine running the Android emulator. I have a web server on my LAN and my emulator can access it directly. Start with pointing Chrome in your emulator at a web server on your LAN (assuming you have one on there somewhere) - if the server is on 10.134.0.178:80 then just type 10.134.0.178 in to your Chrome address bar. If that's not working then you need to look and see what's stopping it - any redirection rules getting in the way?
Don't know what the reason was, but the most plausible one is, that the server had a temporal issue. Now I can connect to my server without further changes!
One thing what still didn't work for me was ping, but it is listed under Local networking limitations:
Depending on the environment, the emulator might not be able to support other protocols (such as ICMP, used for "ping"). Currently, the emulator does not support IGMP or multicast.

Connect Android device to web service in VirtualBox

i have in my laptop in virtualbox a UbuntuServer with a webservice at ip: 192.168.1.46, and webservice, ServerName is api.webservice, so from my laptop if i try in the browser api.webservice it works well!.
Now the problem, from the android device not work, the webservice,laptop and device are connect in the same network, from the device if i try in the browser 192.168.1.46, it tell me it works, but if i try api.webservice not work..
there are any solution?
Probably this is a problem with name resolution.
Your laptap (Windows?) is able to resolve "api.webservice", but your Android device not.
It highly depends on your infrastructure (WLAN-Router, DHCP-Server) how to solve this problem. You could perhaps provision your WLAN-Router/DHCP-Server to permanently bind api.webservice to the IP address of your Ubuntu box, so Android device can make a NS-lookup.
I suppose your Android app will connect a real Internet server in future. In this case, I wouldn't bother connecting the webservice by IP-address for test purposes.
When your app is published and used outside your local network, name resolution will work when connecting to a internet server registered in "official" DNS.

Access a Tomcat local server using android device

I have a Tomcat server running on Localhost. My app can access it in the emulator using 10.0.0.2:8080. But when I connect a device it can't access the server.
I've seen some similar questions but couldn't get this working. can someone give me the steps on what to do?
we use 10.0.2.2:8081 because 127.0.0.1 is reserved for the emulator, however, when you need to try the application through a real device you need to change the URL to your PC IP
go to CMD and run ipconfig, look for IPv4 address, this IP you will use it..
add it to the URL for example: http://192.somethin.somthin.somthing:8081/the-location.php
P.S: you should set your firewall off and turn off any antivirus
The device may not be on the same network as the Tomcat server. Does your network provide VPN access? If so, try installing an Android VPN client (Junos Pulse is a good free one). Connect your device to VPN and try again.
10.0.0.2 looks like an internal address. The emulator is likely able to connect because the machine on which it is running is connected to the network. The actual device needs a direct connection as well. VPN should solve that.

libcurl & android connecting to a web service at localhost

I've managed to connect my app to a web service but I have a problem with the android platform. (If someone doesn't know, with cocos2d-x you can make multiplatform apps)
Right now, the web service is hosted at "http://127.0.0.1:9876/ts?wsdl" at localhost.
I've managed to generate requests for it and it works great in the win32 app. The problem comes when I try to connect to the web service with the android app. It will always give "code: 7" (couldn't connect) but the funny thing is that it will work if I connect to whatever hosted server.
So I wonder why it won't let me connect to localhost, also note that I'm using the emulator since I don't have a device but I don't think that's the problem.
Any ideas?
I assume you are using an emulator instead of a phone. So when you type localhost, it refers to the ip address of the phone, not your pc. Android provides you an ip address which maps to your PCs localhost. So use 10.0.2.2. instead of localhost and it should work.

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?
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.
I was having the same problem and I wasn't been able to find any solution anywhere. What I finally did (after playing around with port forwarding) was to use ssh to create a tunnel to the remote machine:
ssh -L 5555:localhost:5555 10.0.1.14
This should allow you to connect to the local machine's IP address in the emulator (10.0.2.2) and reach the other machine in your network (on the specified port).
If anyone has a better solution for accessing the local network from the android emulator I'd love to hear it.
Intranet site may require proxy.
You can set the proxy in Settings
I have solved this problem by following steps:
adb shell
set setprop net.dns 10.10.20.19(your pc's ip)
restart your emulator.

Categories

Resources