How to connect build app to database?

  • 1
  • Question
  • Updated 4 years ago
hay dear my code is running fine from localhost but build app is not able to make database connection i have updated detail of db connection and hosted php file on server
Photo of vikash mishra

vikash mishra

  • 78 Posts
  • 0 Reply Likes

Posted 4 years ago

  • 1
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
Apps don't make database connections. They simply send ajax requests to a web service, which then retrieves and returns the data, most likely in json format.
Photo of vikash mishra

vikash mishra

  • 78 Posts
  • 0 Reply Likes
edit delete
vikash mishra less than a minute ago
yup i know that but my build app is not able to do sooo same code is working fine with simulator
Photo of vikash mishra

vikash mishra

  • 78 Posts
  • 0 Reply Likes
yup i know that but my build app is not able to do sooo same code is working fine with simulator
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
How did you whitelist your web service interface?
Photo of vikash mishra

vikash mishra

  • 78 Posts
  • 0 Reply Likes
i don't know that please provide me link where i can find the resource for same
Photo of vikash mishra

vikash mishra

  • 78 Posts
  • 0 Reply Likes
i don't know that please provide me link where i can find the resource for same
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
Photo of vikash mishra

vikash mishra

  • 78 Posts
  • 0 Reply Likes
A wildcard - is there in my xml
Photo of vikash mishra

vikash mishra

  • 78 Posts
  • 0 Reply Likes
thanks you are an angel
Photo of vikash mishra

vikash mishra

  • 78 Posts
  • 0 Reply Likes
is already in my xml
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
is already in my xml
Then why didn't you know how you whitelisted the web service?
Anyway, do you wait for the deviceready event to fire before attempting to make ajax/xhr requests to that web service?
Photo of vikash mishra

vikash mishra

  • 78 Posts
  • 0 Reply Likes
yes ajax request is on function after device ready
please help me out
Photo of vikash mishra

vikash mishra

  • 78 Posts
  • 0 Reply Likes
yes ajax request is on function
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
- Is the ajax call reached at all in your javascript code flow?
- Is the ajax call executed?
- Is the request received on the server?

If any of the answers is "no", you need to find out why. Because you're the developer and you have your source code, I can't debug for you.

BTW: "yes ajax request is on function " is hardly an answer to my question.
Photo of vikash mishra

vikash mishra

  • 78 Posts
  • 0 Reply Likes
build apk is not working and white listing you were suggesting is allowed by default
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
What "build api"? We are not talking about the Phonegap Build API, are we?
Anyway, the fact that it runs in an emulator doesn't mean that it runs properly in a real environment, so you need to debug.

If your zip file is publicly available somewhere, please post its url. I'll be happy to have a look.
Photo of vikash mishra

vikash mishra

  • 78 Posts
  • 0 Reply Likes
okay thanks
i will give you link in a minute
Photo of vikash mishra

vikash mishra

  • 78 Posts
  • 0 Reply Likes
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
Here is some feedback:

1. In your zip file, index.html and config.xml should both be in the root ("/"). Not in a directory like /test_new_app or even /test_new_app/www
If you don't do this correctly, PGB will not find your config and will use some default config

2. You are uploading a full Cordova project, including directories like /platforms and /hooks. You can't do that. PGB only wants your assets and a config.
This would be a good time to start reading the Getting Started section of the PGB documentation.

3. In your config, you are using old, deprecated plugins. You should replace them by the latest versions of npm plugins. Be aware that these are named differently (mostly something like cordova-plugin-xxxxx).

4. Your index.html doesn't contain a reference to phonegap.js or cordova.js. Also, you are not waiting for the deviceready event to fire before making any ajax calls.

And unrelated, but still noticable:

5. You can safely remove everything related to blackberry and webOS, because PGB is not going to build these, anyway
You can also remove everything for winphone, because you excluded that OS using platform elements for the other two.

6. You don't have the larger dimensions for Android (xxhdpi and xxxhdpi). The landscape splashes are missing completely, although you have set 'default' orientation, which means both portrait and landscape

7. The larger icons and splashes for iOS are missing, too.

8. An allow-navigation whitelist rule for each of your external links is missing.
Photo of vikash mishra

vikash mishra

  • 78 Posts
  • 0 Reply Likes
btw thanks for suggestion will fix these thing and this is just a test app so have not icons and all
Photo of vikash mishra

vikash mishra

  • 78 Posts
  • 0 Reply Likes
damm i am able to do that you are really a angel dear thanks for helping
god bless you