Search code examples
phonegap

Database records showing on desktop version of phonegap but not on mobile phone


I am running a desktop version of phone gap and I can access the app through the browser. I am using ajax to get mysql database records via php. This works just fine on the desktop but I have installed the phoneGap app on my mobile phone as well. I turn bluetooth on and access the app. I can access the app but the database records do not show.

This is the url I have used in the ajax:

http://localhost:8888/pmobile/www/content.php

I tried using the url from phoneGap but that doesn't work either.


Solution

  • Obviously, the URL that you're using is on you own computer, so how are you expecting your phone to reach your computer?

    You need to host your PHP web application on some publically available web hosting provider, purchase a domain name for it, and then use that URL in your PhoneGap app.

    Also remember to whitelist your domain in the config.xml file of your PhoneGap app, otherwise the security feature on the mobile phone will prevent your app from connecting to your domain.