Android material design Programming Blog

If you are using WAMP server to test your PHP files locally, Android localhost connection and testing PHP in your mobile phone is easy.

If you are working on PHP MySQL with your android app, it’s essential that you need to test your app for correct data before moving your database, PHP files and Android app to production. One way you can test for the same is, going live on the internet by hosting your files with hosting provider and it’s bad idea to test your files live on the internet.

Rather than hosting your database and PHP files on the internet, you can test your app for PHP MySQL using localhost WAMP server. To do Android localhost connection, you need to install and setup WAMP server on your windows computer. If you don’t have WAMP server installed on your computer then you can refer tutorial Setup and Install WAMP Server.

People who already installed WAMP may tried connecting android phone by entering http://localhost/ in your android code but that does not worked for you because your phone does not understand what localhost is, and localhost is only an internal reference to your computer. Follow below tutorial to connect Android with localhost using IP address.

Successfully Running WAMP server on your computer indicates a green icon on system tray, click on that, with a menu pop up click on put online item. Wait for few second to process its task. below is the screenshot of wamp menu.

Now, you need to find your IPV4 address of your computer, run command prompt in your computer(go to Windows start button and start typig cmd) and type ipconfig and enter to see your IPV4 address of your computer. Below is the screenshot of command prompt.

Open your web browser and type your computer IPv4 address and go, for example http://192.168.1.7/. by doing so you likely to see your localhost page. Now, you can access any page in localhost through your computer IP address.

If you don’t know how to connect android to PHP MySQL, you can refer some of tutorial below.

Thank you so much, the login tutorial worked like charm .I have seen many websites but all of them were outdated.I’ll be glad if you can make a tutorial to insert and display in an android device as soon as possible. Thanks in advance

May i know, what portion is not working or any error you are getting? I’m using SDK version 6.0(Marshmallow) to test my app and it’s working fine with me. Usually, it does not depend on the SDK version you are running. May be your IP address changed recheck it and also check WAMP for put online option.

i test my ip address to my mobile device browser before i put into my codes, the problem is , the ip address is not accessible… it’s just load too long..how to i fix that?? plss help..this is for my thesis

I followed your code and used my PC ipv4 address but i am getting connection failed message. My wamp server is running perfect.I checked address with mobile browser and it is showing you don’t have permission to access server. What might caused the issue?