In 2016 OutSystems released Mobile Apps Build Service (MABS), a fast, reliable and secure service for building native mobile apps. (This article explains all the parts of this service). A critical part of MABS is the builder, a core piece where the magic happens. With it, you can deliver a ready-to-install application to your customers, all from a simple build request! Impressive, right? Let’s look at how it works.

How Does the Magic Happen?

The builder relies on its helpers, which are processes that pool requests from the Amazon Simple Queue Service (SQS). SQS is distributed message queueing that stores a collection of items in an established order and is located in AWS. These helpers make it possible for the builder to generate shiny native mobile apps.

The helpers continuously check the queue for requests, and when they find one, they pull it and decode all the information. In the request, there are links to resources located in the Amazon S3 and relevant information about the assets needed to build the application; an AWS worker then prepares all the assets. The assets are icons, splash screens, keys, and other external resources from the app.

Now that the builder has all it needs, the worker is ready to start building your native mobile app. As you might know, OutSystems apps are built using Cordova, an open-source mobile framework that provides the main functionality that allows us to use HTML, CSS, and JavaScript to develop mobile applications.

What Are the Steps for Creating the Magic?

Let's start by creating a new Cordova project. We will use a default OutSystems template with the application structure and all the native code needed for OutSystems apps to take advantage of all native capabilities in a device. It also gives you the best possible performance.

Now that we have created the OutSystems Cordova base project, MABS steps in and starts to process all your resources, moving them to the current project folder. If you have already provided all your app icons and splash screens in the extensibility configurations of your OutSystems app, we now move them to the right folder in your OutSystems Cordova-based project. If you haven't, we use the OutSystems app default icon and splash screen. We now start to create all the required sizes in the right folder.

At this stage, we process all your application preferences and add them to your Config.xml file. The main file of your Cordova project, this XML file controls application behavior and contains all of your configurations.

Everything is ready; it’s time to add the mobile platform. Adding a platform enables us to generate all your platform source code (Android or iOS) using all your application preferences (stored in your Config.xml file). You can find the versions of Cordova we use for Android and iOS here.

How MABS Works

At this point, we install each of your OutSystems app plugins, one at a time. A plugin is essentially a component whose native code is organized by the mobile platform; it contains a JavaScript interface that allows your app to use the device’s native capabilities.

At this stage, your plugin may need to use a supported hook. The following table displays the hooks that are compatible with MABS. To learn more about supported hooks in general, read the Cordova documentation.

 Supported Hooks Description
 before_prepare  Executed before and after preparing your application.
 before_compile  Executed before and after compiling your application.
 before_build  Executed before and after building your application.
 after build

We are almost done! We’ve finished installing all your plugins, so now we’ll process your mobile keys. These keys have sensitive information and are part of this vital step in the build process. This is a vital step in the build process because both Android and iOS apps must be digitally signed with a certificate before they can be installed. For an Android app, we will use your keystore file, but if you don’t wish to provide one, we will use a default keystore from OutSystems. For an iOS app, we will create a temporary keychain with your certificate and provisioning profile.

This Magic Moment: Building the Application!

Everything is set! It’s time for the magic, so let’s build the application!

We will gather all your plugin source code and applicational configurations, and we will generate a mobile package that’s ready to be installed on mobile devices based on the latest versions of Android Build Tools and iOS Xcode and SDKBut your server code is secure because it is not sent to our builder or native applications. Only client-side code and native plugins are sent to the service.

When the mobile package is created, we delete all your information, collect the application package, and return it to you. Each application is built in a brand new context; your application is developed inside a sandbox, and your information is always secure.

With MABS, You’re the Magic Builder

To summarize, the MABS builder abstracts an incredible amount of complexity so you don’t have to worry about it and then generates iOS and Android apps simultaneously. And if that isn’t magic, we’ll eat our magician's top hats.

So, try MABS out for yourself, and don’t forget to let us know how it worked for you by contacting us on twitter @OutSystemsEng.