Q:
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?
A:
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
Putting http:// at the start of the URL worked
Building Lianja Mobile business database Apps
We have also started a troubleshooter for unexpected error message in the PhoneGap Build log (e.g. ones that you can’t fix by correcting your Account Credentials).
Check the PhoneGap Build Troubleshooter for ones we have encountered and their solutions.
Q:
I’m trying to test a mobile application and can’t get the LiveView working. I get the server failed to start error no matter the mobile platform I attempt to use. I followed the steps at https://www.lianja.com/resources/blo…-database-apps to set it up.
I have a phonegap account, set up an encryption key for android, etc etc. It works on one of our computers and not the other and we can’t work out what we did differently!
A:
There is nothing to set as such.
When you install APaaS Developer it will install node.js and the phonegap modules. It then uses these to build the app.
“Live View” does not build the app using phonegap build it creates the necessary directory structure and files required and then runs “phonegap serve” in the required directory.
If the server failed to start you can test it manually by cd to the required directory in a command window and issue phonegap serve.
It may be a firewall issue on your machine or something else is using the port required (see the phonegap develop app on your mobile device it will tell you).
During the install everything you need is installed and setup for you.
The phonegap API to work with the adobe phonegap build service is installed silently after node.js is installed (which it uses).
This is installed using:
It is possible your installation did not complete properly due to an unstable internet connection at the time.
Q:
I’m confused about how a phone app interacts with a cloud server. How do I access data on a Lianja cloud server from a mobile app (for that matter how do I access it with a desktop app)?
I know how to run a web app on a cloud server and access it via a web browser, is there a way to just run a database on the server without an app? Does the associated database get packaged with the mobile app for local access or is it supposed to access it remotely?
A:
If you build a mobile app using best practices and standard sections the data is automatically bound for you. It is a seamless SPA interacting with the database under the control of the cloud server.
If everything is data bound and validation is handled by remote procedure calls for you, and… you can dynamically create HTML5 content into webview sections in what other way are you wanting to access data on the server? You have Lianja.evaluate() and Lianja.evaluateJavaScript() as well as a lot of built-in OData functionality.
A lot of information regarding OData access if you MUST access data programmatically. In most cases you should not need to.
– You deploy your app and its database.
– You specify the mobile app settings in the project settings for phonegap
– You build your mobile app
– In there while testing, it will inject a reference to your local machine and access the cloud server using port 8001
– After you have fully tested everything you change that URL to point at your cloud server production installation
There are example mobile apps included that you can study and install on your mobile devices.
Mobile Apps are regular client/server apps with the UI on the mobile device and the database on a remote server under the control of the cloud server.
Q:
I’ve deployed a quick draft of my mobile app to test ui elements but when I run the app on my phone I can’t get past the login screen.
An incorrect username/password makes the phone vibrate, a “correct” one just clears the text fields and leaves you on that page.
Is there a setting somewhere I need to change to tell the app what to do once authenticated?
I put “correct” in quotes because admin/admin works, but I’ve changed admin’s password in the app builder. Also curiously and perhaps related, the only login that works on my desktop app center is admin/admin, even though that password should be incorrect and I’ve set up other users.
I’ve tried turning off “require login” in the app settings but it still starts with the login page.
A:
Are you running in live view or loading the app onto the phone after building with adobe phonegap build service?
Are you running in a VM or on a bare metal PC?
Have you relaxed your firewall to enable port 8001?
Q2:
I’ve loaded the app onto my Android phone after building it with Phonegap. The server is on the same machine as the app builder, a bare metal Windows PC.
I couldn’t work out how to open a specific port on my firewall so I just turned it off and the same thing still happens.
A2:
Have you deployed the database?
Is the cloud server running?
The way this works for testing is…
– Your router allocates IP addresses using DHCP.
– When generating the code for the mobile app Lianja will look at the IP address allocated to your machine and that is how it connects to the cloud server.
Does this still occur when you build one of the example mobile apps?
You need to follow the guide for debugging android and look in the console on your android device to see what errors are occurring.
So just to clarify… Your android device needs to be connected into the same wifi network as your PC when testing like this.
Re the users you have created or modified, these need to be deployed to be accessible in the Lianja App Center and Lianja Cloud Server.
Q:
I have a problem when starting the PhoneGap Developer on the iPhone.
I wanted to test the Lianja ModileApp Demo.
I start hte iOS Liveview and on the screen on my Desktop Computer all is fine.
But in the iPhone :
He ist connecting and downloading and extraction the app and shows me all static fields like labels but no data.
After a while I get a “Server Connection lost” The Server faild to respond message on my iPhone.
I run Lianja in my companies network and the iPhone is connected with WLAN to our WLAN router.
A:
Your wi-fi connection has to be on the same network as the App Builder.
Make sure that you have enabled port 8001 on your firewall and also that you have deployed the database you are using. If this is southwind it will already be deployed.
Q2:
just disable Windows 7 firewall, and now it works
Okay, made a rule in Windows firewall to open port 8001, and now everything works just fine.
Except….it’s kinda slow. Navigation between individual customers is roughly 3 seconds. Barry, is this normal with PhoneGap?
A2:
Performance depends on your device, your wifi network, your development machine resources, and finally the app.
Why have you enabled port forwarding when using the Adobe PhoneGap developer app? That’s just for testing. If you are accessing via the IP address that you are asked to use this should just work.
Just to reiterate. Live view is just used during development. You have to build the app using the PhoneGap build service.
Q3:
Disabled the port forwarding on the router, leaving just the Windows firewall rule for allowing port 8001, and everything still works great.
As for the speed issue, I was using an iPhone 4. Switched to an iPad, and the speed is MUCH better.
A3:
Ah, an iPhone 4. Not exactly a speed machine. It depends what version of iOS you have on it too. In the earlier versions apple purposely slowed down JavaScript.
Q:
I checked example_webapp4 and once again I can see the PhoneApp View on my computer but when I run the phonegap liveview it does not load on the phone or tablet “Alert Unable to download archive from the server. Unable to properly connect to the server”
When I open the Lianja Server Manager it says “Max Connections 0” which I think may be the issue. It seems to be a Server problem rather than an App Builder problem.
A:
Try disabling your firewall and restart the server. That is the most common resolution.
And just to clarify, the live view uses PhoneGap and node.js. The Lianja server is used for data access in this case so you would see your app even if it was not running. So as I mentioned open up your firewall to verify then enable it and the port you are asked to connect to for the live view.
When you run “Live View” to view a mobile App on your Phone or Tablet a PhoneGap server is started which will serve the files to the adobe PhoneGap Developer App.
Lianja needs to start and stop this server as it needs to be running in the correct directory for a iOS/Android Phone or Tablet.
To accomplish this it runs a small cmd file which you can find in the lianja\bin directory called phonegap_server_stop.cmd .
If you need to customize this thats the file you need to edit.
The login page that is embedded into a Lianja PhoneGap App for phones and tablets can be customized and branded,
The default page for a phone is in c:\lianja\library\mobilelogin\login_phone.html
and
The default page for a tablet is in c:\lianja\library\mobilelogin\login_phone.html
If these files exist in the app directory then they are used instead, so just copy the required file into the app directory and customize it.
Most of the PhoneGap configuration is setup for you when Lianja generates the files needed for PhoneGap Build.
If you need to customize the config.xml for PhoneGap above and beyond what can be done through the UI you can do so.
When code generating for PhoneGap and packaging up the PhoneGap files into a zip file that is uploaded to the PhoneGap Build Service for you, Lianja uses “template” files that can be customized if required.
These template files reside in:
c:\lianja\mobileapps\templates\android\phone
c:\lianja\mobileapps\templates\android\tablet
and
c:\lianja\mobileapps\templates\ios\phone
c:\lianja\mobileapps\templates\ios\tablet
Q:
I have problem about debugging in Python. When I click Open file in debugger, it says: “You cannot run the debugger on this type of file.”
It is possible to debug in python?
A:
No the debugger is for Lianja/VFP code only.
PhoneGap Apps built in Lianja can now optionally use CrossWalk to improve performance up to 10x from the standard Android and iOS WebViews. Other than a performance improvement, CrossWalk also provides a consistent UI on all supported versions of Android and your apps are unaffected by Android updates that could break something. Crosswalk optimization is optional but recommended on both Android and iOS.
I use gapdebug to debug my iOS and Android PhoneGap Apps as I build them in Lianja.
It is free and you can download it from:
https://www.genuitec.com/products/gapdebug/
Alternatively you can use Google Chrome.
Fire it up and goto this page:
chrome://inspect/#devices
Magic.
The order of installing Lianja and MS Visual Studio does matter.
It seams that MS Visual Studio installed its own node.js and prevented Lianja’s correct installation of node.js component.
- CLEAN uninstalled MS Visual Studio (without Control Panel) according this link https://helloacm.com/clean-uninstall…unity-version/
- uninstalled Lianja (in Control Panel)
- installed Lianja again (checked: PhoneGap LiveView Server starts ok)
- installed MS Visual Studio again. Now PhoneGap LiveView Server starts ok.
Advice:
If you need to have Lianja and Visual Studio on the same machine, and want to develop mobile apps in Lianja with PhoneGap: install Lianja first, then MS VIsual Studio.