Results 1 to 3 of 3

Thread: App doesn't connect to server once deployed via phonegap

  1. #1
    Junior Member
    Join Date
    Feb 2016
    Posts
    13

    App doesn't connect to server once deployed via phonegap

    Hi everyone,

    I can't get mobile apps to connect to my server once built with phonegap! It's happening both on my own app and the Lianja Mobile Demo. The weird thing is, there's nothing wrong with the server since I can run the apps fine as web apps. If I put the IP of my server into the web browser I can access my apps and it works fine, but I can't seem to get them to connect to the server as actual apps on my phone built with phonegap. I put the base URL in the phonegap settings as 192.168.0.4:8001, is there any more to it than that? 192.168.0.4 being the internal IP of my dev machine with an instance of the cloud server running on it, of course.

    I believe I've confirmed that the problem is in the connection with the server. I've spent the first half of the day debugging the mobile apps via chrome (following the steps at https://www.lianja.com/resources/blo...ps-with-chrome) and when my app calls Lianja.evaluate() in its init delegate the evaluate fails. Going through the calling functions to the error being thrown, it appears that no data is ever returned to the client from the call that evaluates the function on the server (the function is valid and always returns at least something). The Lianja Mobile Demo on the other hand breaks on attempting the GET calls to load the tables saying page not found. Also login functionality is broken in both apps.

    Finally, when I look at the server logs, it doesn't mention anything about a client connecting during the time I was running the mobile apps. They only mention a few things that seem to be server setup, then say "waiting for client connection on port 8001". The only time it mentioned any requests was when I ran the apps in my browser instead.

    Since the apps connect to the server in a browser but not as a built phonegap app, I believe I've done something wrong in my deployment. Is there anything extra that you need to do to get a phonegap app to connect to a cloud server apart from setting the base URL?

    Thanks,
    Ryan
    Last edited by rhoward; 2016-02-18 at 21:52.

  2. #2
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,377
    Hi Ryan,

    When you say they work in the browser - do you mean from the browser on the same phone?

    Also, for the Base URL in the App Options for the PhoneGap Build, did you put the full URL?

    http://192.168.0.4:8001

    Thanks,

    Yvonne

  3. #3
    Junior Member
    Join Date
    Feb 2016
    Posts
    13
    Hi Yvonne,

    Putting http:// at the start of the URL worked. With the Lianja Mobile Demo app, anyway. With mine it just shows a blank grey screen now but I'm willing to bet that's a bug in my app instead of an issue connecting to the database. Which I can go through debugging now that I can connect.

    Thanks!

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us