Building Lianja Mobile business database Apps

From Lianjapedia
Jump to: navigation, search

See Also

Guide to debugging Android Lianja Mobile Apps with Chrome

Overview

Lianja Mobile Apps are multi-tier client/server Apps that run on iOS, Android and Windows Phone phones and tablets. They interoperate with a Lianja Cloud Server running in the cloud on either Windows or Linux.

Building Mobile Apps can be a daunting experience for people who have no knowledge of Web and Mobile technologies. Fear not. In this document I will outline step-by-step how you can develop, build and test Lianja Mobile Apps. Once you have configured a development machine it's a relatively painless experience.

It is important to remember that Lianja is not just an IDE, it is a complete Apps Platform. It provides everything you need to build and deploy scalable business database Apps for desktop, Web and Mobile.

Let's quickly review the five pillars of Lianja.

  • Lianja App Builder
  • Lianja SQL Server
  • Lianja Cloud Server
  • Lianja App Center
  • Lianja Hosted Cloud

You build and test your mobile Apps visually in the Lianja App Builder, deploy them (and their data) to a Lianja Cloud Server and test them live on your Phone or Tablet.

Lianja Cloud Server embeds Lianja SQL Server so you do not need to use any other database unless you absolutely want to.

The Lianja Cloud Server can also work with external third party databases such as MS SQL Server, MySQL, PostgreSQL and others. This is completely transparent to your mobile App due to Lianja Virtual Tables.

Lianja Virtual Tables operate like native Lianja tables but they abstract the database access and CRUD operations specific to each SQL database away from the inner workings of your business logic and your presentation UI.

This is fundamental to the way the Lianja Platform operates.

Let's quickly review the Lianja Platform.

The Lianja Apps Platform


You will typically install a Lianja Cloud Server privately on your own premises and optionally obtain a domain name that will be used in your Apps (so that no numeric IP address is used). You can register a domain name with a variety of companies e.g. Network Solutions. This domain name or numeric IP address is in the PhoneGap settings for the App. This is where you should deploy your App and data.

Alternatively you can create a virtual instance in Amazon AWS, Google Compute or Azure and install either Windows or Linux on it, then install the Lianja Cloud Server.

If you don't know what the Lianja Cloud Server is then you need to read about it on the Lianja web site first and experiment with some simple Web Apps to familiarize yourself before embarking on building and distributing mobile Apps.

The following step by step guide shows you what you need to do to be able to build Lianja Mobile business Apps that can be submitted to the Apple App Store and Google Play.

Adobe PhoneGap Cloud Build service

The first thing you need to do is register an account for the Adobe PhoneGap Build cloud service. This will allow you to build your Lianja Mobile Apps remotely using the Adobe service without having to install any SDKs on your development machine.

You can register with the PhoneGap Build Service at:

http://build.phonegap.com

Details of the plans available are as follows:

Adobe PhoneGap Build Service Plans


Note that although 'open source apps' can be built using the PhoneGap Build service interactively they cannot be built remotely from the Lianja App Builder.

iOS developer

You can register as an Apple developer at:

http://developer.apple.com

Note: Since PhoneGap Build uses Apple's standard development process to build applications, you will need to sign up for their developer program to build iOS applications on PhoneGap Build. You will also need a Mac to configure your certificate and provisioning profile. There is no way this can be done on a Windows or Linux machine.

After registering as an Apple developer you must now generate your code signing certificate and associate that with your Adobe PhoneGap Build account.

Xcode is the easiest way to request certificates. Connect your device to your Mac and click Use for Development in Xcode's Organizer window. Sign in with the Apple ID associated with your iOS Developer Program membership and Xcode will automatically generate your certificates. Xcode is a very large (free) download for your Mac but is the easiest way to obtain the certificate that you need.

Full details can be found at:

http://docs.phonegap.com/phonegap-build/signing/ios/

Android developer

To setup Adobe PhoneGap Build for building Lianja Android Apps you need to generate a private key which is used to sign your Android Apps and associate that with your Adobe PhoneGap Build account.

Unfortunately this requires that you install Java just so that you can generate the private key (duh!).

Full details can be found at:

http://docs.phonegap.com/phonegap-build/signing/android/

Note: The Java download link on that page will take you to the JRE download. The JRE includes 'keytool' - you don't need the JDK. Instead of adding the JAVA_HOME environment variable, just add the JRE bin directory to your existing PATH environment variable. Alternatively, run keytool from the JRE bin directory itself or using its full path. Remember to use short directory names if the path has spaces, e.g. my JRE bin directory is C:\Program Files (x86)\Java\jre1.8.0_51\bin so to call keytool I can use C:\Progra~2\Java\jre1.8.0_51\bin\keytool.

Distributing your Apps

In this document we will concentrate on Apple iOS Apps and Android Apps.

Apple App Store

To distribute the Lianja Mobile business Apps on Apple phones and tablets you need to register with Apple as an Apple developer. The cost of this is $99 per year.

You can register as an Apple developer at:

http://developer.apple.com

Google Play

To be able to distribute your Lianja Mobile business Apps on Android devices you need to register with Google Play. The cost of this is $25 per year.

You can register at:

http://developer.android.com/distribute/index.html

Testing your Apps

The easiest way to install your Lianja Mobile Apps on your phone or tablet for testing is:

  • Download and install a QR-Code Reader App. There are several free ones on both iOS and Android.
  • After a successful build using the Adobe PhoneGap Build service, login to your PhoneGap Build account and select Apps. You will see the Apps that you have built along with a QR-Code to the right of them.
  • Using your mobile device (phone or tablet) use the QR-Code Reader App to read the QR-Code.
  • You will then be prompted to download the App from your PhoneGap Build account.
  • You can then install the new build of your App on your Mobile device for testing.
App QR Code


And now the good news...

The good news is that after you have gone through all this pain to setup a PhoneGap Build account, subscribe as an Apple Developer and register with Google Play, you can build Apps in Lianja and view them live on your iOS/Android phones and tablets without first building them in Adobe PhoneGap Build. This is accomplished by using the PhoneGap Live View Server, which is built into the Lianja App Builder. When you want to distribute your Apps you will still have to build them using Adobe PhoneGap Build, but you will have saved many hours by being able to first run and view them on a phone or tablet connected into your local Wi-Fi network as you develop them.

Let's build a Mobile App!

Create a Project

Start the Lianja App Builder and create a new Mobile Project by clicking the Create Project tile in the Home workspace.

Create Project


If you want to try out some demo Apps before creating your own, just open the lianja_mobiledemo Project (double-click on its name in the Projects workspace), then open any of the Apps it contains by double-clicking the App name.

Create a new project


Create an App

Create a new Mobile App by right-clicking in the Projects panel and selecting "New App...".

Create an App


When creating a Web or Mobile App set the scripting language as JavaScript in the App Settings. This is the client-side scripting language but you can call server-side business procedures that are written in Lianja/VFP or JavaScript (soon PHP or Python too).

JavaScript Scripting Language


Visual App Development

Develop a simple Form App visually then click the Phone App View icon as indicated below.

Simple Form App


Phone App View

Display the Phone App View by clicking its icon as indicated below.

Phone App View


Notice how Lianja is generating the App with a responsive layout to better suit a Phone device in this case.

Live View

In the Phone App View click the LiveView icon. This will start the PhoneGap Live View server. After the server has started a message is displayed informing you of the IP address to specify in the next step.

LiveView


Adobe PhoneGap Developer App

Run the Adobe PhoneGap Developer App on your mobile device then specify the IP address which you were given in Step 5 above.

Adobe PhoneGap Developer App


You can iterate your development in the Lianja App Builder and click the Refresh icon in the Phone App View at any time to update the App running in the Live View on your mobile device. You can change the operating system type at any time in the Phone App View or the Tablet App View by selecting it from the ComboBox at the top of the view. This will cause the PhoneGap App to be dynamically re-generated and the PhoneGap Live View Server to be restarted automatically.

PhoneGap Build

Select the Build workspace in the App Builder then select the PhoneGap Build Tab and specify the build settings as described. Notice that you can manage existing builds by specifying your PhoneGap Build Account Credentials then clicking the Refresh button. The status of your existing builds will be displayed. The Adobe PhoneGap Build Service limits you to 25 builds. You need to delete older builds or the builds will eventually be rejected. You can delete individual older builds by clicking Delete on the left hand side column of the build information or click the Purge button to delete all your builds.

PhoneGap Build


PhoneGap App Settings

Create some new PhoneGap App settings by clicking New specifying a unique Application ID and then specifying the settings in the tabs as shown below.

App Options


The Base URL is important as this will be embedded into your App when you build it. This should be the base URL of your Lianja Cloud Server. If you are testing your App on a mobile device then this will default to the IP address of your development machine e.g. http://192.168.1.5:8001/.

To be able to run your mobile App, don't forget to deploy the App and its data. Why? Because the resources needed such as the .rsp pages and the remote procedures need to be accessible on the remote Lianja Cloud Server.

All JavaScript files, images etc. will be embedded into your PhoneGap App. When you build the App Lianja will minify all the JavaScript and CSS for you to keep the PhoneGap App as small as possible.

Further configure your App in the App Preferences and App Plugins tabs.

App Preferences


App Plugins


Click Save when the App Options, App Preferences and App Plugins configuration is complete.

Build

After selecting the PhoneGap Build Service Tab, select the Device Type and the Operating System then click the Build button.

Lianja App Builder will dynamically generate the PhoneGap directory structure needed to build the App and will request a remote build using the Adobe PhoneGap Build service. The PhoneGap Build Log will provide progress messages during the build process so you can see what is going on.

PhoneGap Build Service


If you get an unexpected error message (e.g. ones that you can't fix by correcting your Account Credentials), please check the PhoneGap Build Troubleshooter for ones we have encountered and their solutions.

Your Apps

If the build is successful (as detailed in the PhoneGap Build log) click the VIEW WEBSITE button and then select Apps. You will need to login with your Adobe PhoneGap Build credentials to do this.

Once logged in, you can also use the PhoneGap workspace VIEW APPS button to go directly to your apps. Click APP SIGNING or APP PLUGINS for more online information and SERVCE STATUS to check the status of the PhoneGap Build Service.

PhoneGap Workspace buttons


Your Apps


Scan QR-Code

With the Apps page displayed, open the QR-Code Reader App on your mobile device and scan the QR-Code for the App that you have just built. You will be asked if you want to download it, answer yes, then yes again to install it.