How to test a JavaScript web application in a real Android device?

Issue

I have a javascript web app built using VS code, and I want to test it in a real Android device. What are the steps to take to do that?

P.S. I’ve been searching online but didn’t find any useful answer. Those solutions just test it in a simulator. Does using a mobile device view in Chrome developer tools sort of similar to testing it in the simulator?

Here is the part of the meta tag in the header of my index.html file

 <meta name="apple-mobile-web-app-capable" content="yes" />
 <meta name="mobile-web-app-capable" content="yes" />

which inform the borwser to open the app without a menu bar.

Solution

  1. Run you web application locally (localhost:xxxx).
  2. Connect your actual android device to your system.
  3. Open Chrome and go to chrome://inspect/#devices.
  4. Select the port forwarding and setup a rule (ie. port - xxxx, address - localhost:xxxx) and make sure to check Enable port forwarding.
  5. Now you can just navigate to localhost:xxxx and run your application on your android device.

For more reference you can checkout this document.

Answered By – varun agarwal

Answer Checked By – Clifford M. (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *