I'm having trouble accessing my server (WAMP) using my real android device. I have an app that downloads the data and parsing it to my listview. In the emulator everything is working fine using "10.0.2.2" I tried 10.0.2.2:80, 10.0.2.2(without port #), (my laptop's ip) 192.168.254.103:80 and 192.168.254.103 (without port #) in my url. My WAMP is online and I even tried turning off firewall. Is there something missing?
UPDATE
I tried browsing via my phone's browser the ip address of my laptop and it says "FORBIDDEN". i tried configuring the httpd.conf of apache based on what I've researched but still can't access the server. please help.
Turn off Firewall -
Give permission to "WAMP folder" by using Folder
sharing options - Basically access to "All" for read, write
Related
I have a Xamarin app and localhost API. I'm trying to connect to the API from the app, but it could not be found. I edited my applicationhost.config file and I tried localhost, 10.0.2.2 and my IP address in the call, but it was not working.
So, how do I configure simple API access? (The API itself is working well)
There is simple workaround to connect Emulator & Simulator to localhost API.
Download third party software NgRok for Windows at any specific location of your PC. It just contains one executable file called ngrok.exe (you not need to install it).
Now execute your service on your preferred browser. Than follow below steps.
Open your ngrok.exe file path in command prompt
Keep your service url (take from your browser) with prefix ngrok http --host-header=rewrite and hit enter.
Now go to your browser where you have executed your service open new tab and type localhost:4040 than press enter -->Go to status there you will find your public url which you can use in your mobile application.
Note: Url structure should be like this public const string BaseUri = "https://8c56892f.ngrok.io/"; followed by / in last. Try not to append unnecessary /.
Benifits
You can debug services from one Visual Studio to another.
Your url will be active until you close command prompt.
In browser or command prompt track your requests status like Ok, Not found etc.
For more information visit this https://www.c-sharpcorner.com/article/exposing-local-web-server-to-internet-using-ngrok/
Hope it help you.
That 10.0.2.2 address is used for the Google emulators. For the Microsoft emulator you want to use 169.254.80.80. If that doesn't work then it must mean you have the firewall on and it's blocking the traffic. That can be solved by adding a new incoming rule for the program or port.
I have a little problem with the Network Image from Flutter.
When I try to load an Image from the internet it is working fine but as soon as I try to load from my Localhost it's showing nothing, no exception in the logcat, just nothing.
I have also looked to related questions but nothing from the mentioned solutions worked.
Here is an example URL http://IP_ADDRESS/path/to/image.jpg
I have already included the internet permission in Android manifest.
I am testing on a real Android device.
When I'm pasting the URL in my browser it shows the right image.
i set the base url on flutter app as my local computer ip first
then when i get url image from server i change the "localhost" part into computer ip address and it showen in the app and external device also
the url link for image must be seen by your device , in your case localhost means your phone device but not your computer . if your device is web (chrome) you will not see the localhost , but if your device is android phone (usb or virtual) then you have to use your computer ip instead of using localhost like :
http://192.168.1.10/myproject/images/myimage.png
because the localhost in this case is the webserver installed on your device .
if you want to use localhost like :
http://localhost/myproject/images/myimage.png
then you have to install a webserver on your mobile device.
I use chrome://inspect page on Chrome PC to use dev tools on Chrome Mobile.
I have my js+webgl games on a "local" website, http :// 127 .0. 0.1/site/, thanks to EasyPHP.
I use to upload the game to a real web server each time I make an edit and want to test it on Android, but I really would prefer the Android device to directly access the local website on my computer.
I know it is possible with the "port forwarding" feature on chrome://inspect, but I do not get it to work.
It uses 8000 as port and localhost:8080 as address.
There is a green dot aside the name of my Android device, so port forwarding is supposed to work.
But when I open http :// 127 .0. 0.1/site/ on the Android device, it says "Oops! Google Chrome could not connect to 127.0.0.1".
What am I doing wrong ?
As long you are in the same network ( fe your home network) both devices can see each other. And if you enabled the ping-command on your operating system you can use to test this.
On the application layer they need the same ports to also talk to each other.
For this talking Easyphp runs the Apache webserver to listen the network for request.
As you remarked; Apache is listening the network on port 8080.
The flexibility of Apache is that you can change the number of that port yourself in the configuartion file. ( see https://collab.its.virginia.edu/wiki/toolbox/example%20httpd.conf%20file.html)
Once you completed this, you will get an error message that you have no access, and you should be happy because this means that both devices can already talk with each other :-)
The error message are thrown up by the build-in security-system of your webserver. This security is most of the time provided on folder level with text files ( see http://www.htaccess-guide.com/ )
Once made these changes your access your localweb folder (or htdocs in ?AMPP) from out the browser of your Android. And is the game on :-)
I have a phonegapp App running on an Android emulator and I would like to access my ASP.NET MVC 4 server in order to make a log in request.
The problem is that my Emulator can't access my IIS application.
I tried this :
Use 10.0.2.2:port to refer my web site from the android navigator.
Use my local ip address (192.168.0.1:port)
Disabled my Firewall
Change bindings in my configuration file in IISExpress
Despite of that, i've got a "400 bad request error invalid username"...
Can anyone help me ?
I had the same problem. the port number in url isn't recognized by android emulator. so wehn I open visual studio project settings, I changed the IIS settings to have a virtual directory under the local host (for example "localhost/testPorject") instead of "localhost:PortNumer". this worked and the emulator recognized it.
I've started android emulator app and trying to open from embeded browser locally started web-site, but local dns name (from /etc/hosts) is not resolved. Is there any option to enable local resolving?
Refer this URL. The issue is 127.0.0.1 is not the correct IP for accessing local server sites on emulator.
http://localhost:8080/MyTestPage.html // URL to use in computer browser
http://10.0.2.2:8080/MyTestPage.html // URL to use in emulator browser
However, you need to do some configuration changes as suggested in the URL.
Here's how to access a locally hosted website in the Android emulator.
Use IIS/Apache to host the application.
For some obscure reason, Android Virtual Device would not let you connect to the development server created by Visual Studio.
Once you host the application, use your IP address as the web address to connect to the local website. "localhost" just won't work with the AVD. Just go to the command prompt and type ipconfig to get your local ip address. You should be looking for IPv4 Address
Here's Android AVD connecting to Apache (XAMPP)
Here's connecting to IIS
Good Luck everyone and happy testing!!
You should specify your local ip address in browser, something like 192.168.xx.xx