B4J Tutorial [BANanoVuetifyAD3] Using a real device to debug your localhost running webapp

Hi there

You are developing your app and want to see it running on your device instead of your machine from localhost.

The easier method:

1. Enable hotspot on your phone.
2. Connect your PC to your phones hotspot.
3. Execute cmd > ipconfig > note the IP4 IP Address
4. Enter this IP address on your mobile device/

For example, my PC app is on http://localhost/mybvad2webapp/index.html#/

So on my mobile device, i enter xxx.xxx.xx.333/mybvad2webapp

Happy BVAD3 Coding.
 

sdleidel

Active Member
Licensed User
Longtime User
If you only want to allow access from your local network,
then change the following line in the File "Your Driver Letter:\laragon\etc\nginx\sites-enabled\00-default.conf
Then, you can test, the sites from your mobilephone.


code:
server {
    listen 80 default_server;
    listen 443 ssl default_server;
    server_name localhost ;
    root "C:/laragon/www/";
    
    index index.html index.htm index.php;
 
    # Access Restrictions
    allow       127.0.0.1;
    denied     all;     --> change this to "allow    all";
 

assistant

Member
On my computer (where B4J and XAMPP reside), Sign In webapp works fine (),
but on android phone it does not (no respon upon clicking Sign In) (video)
Computer and phone connected to same network (LAN)
Please advise.
 

assistant

Member
On my computer (where B4J and XAMPP reside), Sign In webapp works fine (),
but on android phone it does not (no respon upon clicking Sign In) (video)
Computer and phone connected to same network (LAN)
Please advise.
Sorry the Windows video is the wrong one ( still using "localhost" )
This is the one that using ip address :
 

assistant

Member
Please check the web console, there might be something there.
Hi Mashiane

I get the web console of the android's chrome via usb debugging.

At first I got the following result (web console shows 'localhost' even though the address bar clearly shows that I'm accessing the website using ip address :
temp.jpg


But after intentionally navigate to another website then back to my testing website, I can logged in.

The problem now is that Navigation Bar is missing :
temp1.jpg

( switch to Desktop version or changing to Landscape orientation does not change anything )

Please help. Thank you
 

assistant

Member
I think you forgot to change the ServerIP on config.properties file to match where the app is hosted.
Thanks for the reminder, Mashiane

After change it, the console display correct host ip address but same error :
temp.jpg

( to avoid complication, I'm now using another computer instead of android phone )

FYI the following telnet command worked ok :
B4X:
telnet 172.16.0.79 3306
 
Top