Test mobile web app in mobile device's browser using localhost - android

I want to test a mobile web app on mobile device. I am currently developing my mobile web app. It is still on my local environment i.e. localhost:8080. Now I want to use same hostname and port to access this web app on my mobile device. I need this because my mobile web app is also using HTML5 Accelerometer API. I need to test if it is working. I can use google chrome dev tools to emulate responsiveness but I need to test it on real device.
How can I test it on both Android and iPhone?
UPDATE
Below is my nodejs server code
'use strict';
var express = require('express');
var app = express();
app.use(express.static('./dist'));
console.log('\n0.0.0.0:8000\n');
app.listen(8000, '0.0.0.0');

As Rosário said, you can connect to the same Wi-fi network as your computer and type in the computer's IP in your phones browser.
I don't know how experienced you are so make sure that you..
a) Use your computer's local IP. E.g. looking up your own IP on www.speedtest.net won't help since this is your public IP.
b) Type in the port in your phones browser.
E.g. if your computer's IP is 192.168.0.10 then you need to type in http://192.168.0.10:8080 as the url in your browser.

Simply connect your mobile to the same Wi-fi network as your computer. And then Enter the Computer's IP on the mobile's browser.

Android app "KWS"
Its a good option to test webserver,

Related

Blazor Server-side app Android and IOS mode

I am building a Server-side Blazor web application on localhost for now.
I want to test my web app on android and IOS devices but I cannot seem to find the solution.
I have tried connecting to the same network via wifi and have my IP address with :port but doesn't work.
You could give ngrok a go, this would allow you to map your localhost and port to a public web address.
There are a bunch of details here:
https://ngrok.com/

How to access url with hostname on laptop from android mobile app

We have mobile apps installed on Android mobiles and ASP.NET Core web API application deployed on IIS server on Windows 10 Laptop / PC.
my Android phones and laptop are connected to the same WiFi network created with Mobile Hotspot on Laptop, we can reach the IP address from mobile and also able to call web api. (Note: we are not using Wifi Routers)
Scenario 1: Working scenario
Web API deployed with default settings and if access with laptop ip address we are able to hit api successfully.
But due to dynamic nature of the ip address on laptop we have to change ip address every time in mobile app. We would like to avoid this situation by using hostname.
Setting static ip address on laptop is also not solution for us. So we have planned following scenario.
Scenario 2: Proposed solution
Web api application deployed on IIS 10 on laptop, with following settings in IIS
Binding Section :
IP Address: All Unassigned
Port : 4041
Host name : xyz.com
Also made the entry in the host file as
127.0.0.1 xyz.com
Now I am able to access the Web-API from laptop browser with the URL: http://xyz:4041/.
When I use the http://xyz:4041/ on mobile browser I am getting error “the site can't be reached” & “refused to connect”
Pls help me to resolve this issue.
There are many reasons for this error, you can try the following methods to fix this issue:
1.Clear cache and cookies and try again
2.Reset Your Chrome Browser Settings
3.Restart the DNS Client
4.Change the DNS Servers
5.Flush the DNS Cache
6.Reset the TCP/IP Address

Debugging HTTPS local services from my mobile device (web, api, websocket)

Having a hard time debugging from mobile device my local development web app which connects to a GraphQL node server and another service using web sockets. All three services running on HTTPS to the below ports.
Web Reactjs app: https://localhost:3335
Node server: https://localhost:3334
Web socket server: wss://localhost:4443
From my macOS machine, everything works as expected but when trying to access the reactjs from Chrome Android and using the inspect desktop devtools and USB cable navigating to https://localhost:3335 works but I get the error POST https://localhost:3334/dev/graphql net::ERR_CERT_DATE_INVALID.
My iOS device doesn't even connect to localhost:3335 or 192.168.2.3:3335.
I am open to any tips, tricks, services, and ideas to debug using my local development machine and mobile devices.
I was able to make it work by navigating to all addresses in the mobile browser and accept the risk of a self-signed certificate.
https://localhost:3334/dev/grapqhl -> accept
https://localhost:4443 -> accept
Now https://localhost:3335 will work fine.
Struggling with iPhone debugging due to localhost not binding to the machine IP address (Pending solution, might create another SO question for reference).

How to serve my localhost server that runs on my android to my android hotspot clients?

I have my android phone that runs a node.js server/website.
I wonder how can I provide this website to anyone that connects to my hotspot.
In addition would be nice that for any URL to redirect to myurl.com and then serve that local website to anyone that goes to myurl.com.

Can I do client- server communication between Android mobile and local xampp server

I want to learn client - server communication in Android. As per my understating, to communicate with the server we need a valid URL. My doubt is that, can I communicate Android mobile client with the local xammp server???? If yes, please explain me...
Thanks in advance...
yes you can do that if you are using android emulator then use http://10.0.2.2 ip address to access localhost, for genymotion use this http://10.0.3.2.
You can also use Google Chrome's port forwarding but you need google chrome on computer and emulator or device.
if you want to access localhost using port forwarding then open following address on google chrome chrome://inspect and enable port forwarding and set port and ip address.

Categories

Resources