How to Build and Test an Android Application

by Lucio Bordonaro
5,620 views Published on Jan 14, 2015
Applies to: 8.0 or higher
Table of contents

Introduction

WebRatio Mobile lets you build Android apps that you can test on your mobile or submit to the Google Play Store. This article guides you through the build process, showing how to create a debug build and run and test the Application on your device.

Prerequisites

The procedure shown in the article requires you to have:

  • an active internet connection to build the project
  • an Android Device to test the build (with active internet connection or alternatively the USB plug)

Build Android App

You can easily build an Android app creating and configuring an Android build configuration for your mobile project. You can even create more than one build for the same mobile project according to your needs. The build process is done in a single-step and requires an active Internet connection since its executed on a WebRatio Cloud Server.

The Build option  is available in the main WebRatio Mobile Platform toolbar.

Press this button to open the Build As Configurations dialog.

To create a Mobile Android Build Configuration, right-click on the Mobile - Android option and select New. A dialog called Build As Configuration is shown. Configure the properties as explained in the next section and press Build to start the build process.

Debug Build Mode

This build mode can be used to create a mobile application package that allows you to test and debug the application directly on the device, without publishing the application on the Google Play Store.

Moreover remember that a debug build cannot be used for the Google Play Store submission.

To create a debug build you need to configure the Build As Configuration dialog (build-dialog hereinafter) using a subset of the properties available in the Main tab.

The Main tab of the build-dialog contains the information needed to correctly create the mobile application package.

The Project property is reference to the mobile project you want to build. It is preloaded with the currently open project, however you can choose another project using the Browse button.

The other three properties, App NameApp Id and App Version are respectively the name, the unique identifier and the version of the mobile application. These properties are preloaded by WebRatio Mobile Platform, but you are free to change them as needed. All three properties are mandatory in order to build the project successfully.

Then, to create a debug build set the Build Mode property to Debug.

All the other properties are not mandatory and not requested when building in debug mode.

The Target Devices lets you choose which devices will run your App.

Let's focus on the most interesting two: Account Manager App Id and Notification Sender ID.

The Account Manager App Id property enables your app to share the access credentials (username and password) with other apps built with WebRatio Mobile Platform. To use the credentials of a mobile application you have to set this property with the App Id of that mobile application. The number of mobile applications that can share their credentials is unlimited. 

In a situation where you want to share the same set of credentials used for the mobile app A with the apps B and C you have to put in the Account Manager App Id property of B and C the App Id of A (ex: com.yourcompany.a). 

The Notification Sender ID property is required if your app needs to use Push Notification. In that case you have to set this field with the Project Number that you can obtain at step three of this tutorial.

The Model tab contains some project configuration properties that let you customize the behavior of the mobile application. It’s not mandatory to set the properties of this tab, it depends strictly on your mobile app.

The Back-end Base URL is the URL of the remote back-end server. If your app uses one remember to set a value for it.

The Check Credentials on Resume flag states whether or not the user credentials must be checked every time the user opens the mobile application. This is another option strictly related to your app structure.

Once all of the properties are set correctly you can press the Build button to start the process.

A dialog will show you a feedback message about the build execution.

Build Result

The build process ends successfully and you will see a page showing the App Dashboard.

From this page you can:

  • Download the *.apk package from the Download App Package link and then move it to the phone using the USB transfer
  • Scan the QRCode to start the download of the package right onto your device. The QRCode can be eventually scanned using WebRatio Mobile Developer app which will directly start up the installer.

To learn how to install and run a build on your device, refer to the next chapter of this article.

Install and Run an App on your Device

Android devices do not let you install and run non-Market applications.

In order install and run the *.apk file generated with WebRatio Mobile Platform you need to configure your device in order to accept applications coming from Unknown sources.

Let’s see how to run the Hello World app on your device, assuming that you already created the build for it. The screenshots shown in this tutorial may slightly differ from your device.

Just follow these steps:

  1. Go to Settings and open the Security options.

  1. Tap OK to apply the changes.

  1. Now you can either scan the QRCode or download the *.apk package from the dashboard screen and proceed with the install.
     
    If you scan the QRCode a URL will be shown and if you open that URL the *.apk package will be downloaded right into your phone; otherwise you can plug the phone to the PC using the USB cable and store the *.apk package into the phone.

    The QRCode can be eventually scanned using WebRatio Mobile Developer app which will directly start up the installer.

    Once the file is stored into the phone you can open it and use the Package Installer to install it and to see the phone features required by the app.

  1. Tap Install to let the installation start. It will take some seconds, at the end you will see this dialog confirming that the app is installed.

  1. Tap Open to run the application.