Building & Distributing an Android Application

1. Introduction

MobiOne Studio's App Center Builder service enables you to build Android applications (.apk files) that you can install onto your Android devices or upload to an Android marketplace for distribution. The app builder process is performed using the MobiOne Build Android Application wizard. This wizard walks you through a series of forms that collects the required information to build a custom application. In this tutorial you learn how to:

  • Use the Build Android Application wizard to create and submit an application build request.
  • Monitor the build process and review the results.
  • Install the application .apk file.
  • Build for Android marketplace distribution.

Note: To create Android applications for marketplace distribution, you are required to provide provision data files as input to the build process. If you are unfamiliar with the Android provisioning data files, Section 5 instructs you on how to acquire these files. For ad hoc testing purposes, no provisioning data files are required.

 

2. Using the Android Build Application Wizard

When you build an Android application with MobiOne, optimized HTML5 mobile web source code is generated from your UI design files. The mobile web source files are then uploaded to the MobiOne App Center cloud service where they are compiled into an Android application. The Android Build Application wizard walks you through entering the information required to build your application.

  1. With your project's startup UI design file open in Design Center, click the arrow on the Build Application icon , and select Build Android Application from the menu.
  2. Enter your email address, review the App Center Privacy and Usage Policies, and click Next.
  3. Providing email address required for the App Center cloud service
  4. Enter the name, installation filename and version for your application. These fields default to the name of your .mobi file. Click Next.
  5. Naming the application
  6. Choose the size of device on which you want your applications to run and the orientation. Click Next.
  7. Selecting devices and orientation
  8. The Files & Data page displays the files generated by MobiOne to run your application as a mobile website. These are the files used to build your Android app. By default, all generated files are selected and will be part of the build. Click Next to accept all files.

    Note: You can add additional files by clicking the Import icon .

  9. Accepting all generated files to be included in the build
  10. Select the None - Use Development Certificate option. This allows you to build the app for ad hoc testing on your device.

    Accept the default application package name, or enter a different name. The name must be unique and conform to standard Java package naming guidelines. Select the Make Signing Data Default checkbox to retain your digital signing selections as defaults.

  11. Using the development certificate option for ad hoc testing
  12. Click Next to specify an application icon. The size specifications appear on the wizard page. As a convenience, if you leave all image fields empty, MobiOne App Center will provide a default application icon.
  13. Selecting an application icon image
  14. Click Next to specify services required by your application. When you select services, users are notified during installation that the app will be given access to the selected services. Click Next.
  15. Selecting required services
  16. Enable/disable desktop notifications. For email notification enter your email address in the Email Recipients field. You can send to multiple recipients by separating the addresses with a semicolon.

    When you include an email address that is accessed from your Android device, you receive notification on your device when the build completes. The notification includes a link from which you can install the app onto your device.

  17. Entering notification information
    • With the Desktop Notification checkbox selected, you receive a popup notification on your computer screen when the build is complete. The notification displays the file location of the .apk application file or an error log if the build failed. Clicking this link opens the folder containing the app (.apk) file.
    Desktop build notification
  18. Click Finish. The application source files and the build configuration information you provided are uploaded to the App Center, and the build process is initiated.
  19.  

3. Monitoring Your Application Build Process and Results

The Application File (.apk) and its Location
The application build process creates your app in the form of an installation file with an .apk extension. The .apk file is automatically downloaded from the MobiOne App Center and stored in a <.mobi filename>-android folder in the same folder as your main project UI design file. For example, if your UI design file is named myApp.mobi, your application file is placed in a folder named myApp-android.

A copy of the .apk file is retained by App Center to support wireless (over-the-air) installation described in Section 4.

.apk file

If you build an application multiple times, the resulting .apk files are not overwritten. Instead, a version number in parenthesis is added to the filename. The example above contains (1) in the filename, indicating it is the second build of form.apk.

Monitoring  the Build Process - Progress View
Depending on the size of your application and the load on MobiOne App Center Builder servers, your application build process can take from 30 seconds up to 10 minutes. While waiting for your build process to complete, use the Progress view to observe the stages as your build progresses. You can also cancel a build process by clicking the Stop icon .

Progress view

Completed build jobs include a link to access the newly created Android application or error.log information in cases where a build fails.

App Center Progress view with completed build and status message

Desktop Notifications
Depending up on how you configured notifications in the Build Android Application wizard, you can receive desktop notifications and email notifications when your build process completes. A desktop notification is a popup dialog that appears in the lower right corner of your computer display.

Desktop build notification


By default desktop notifications remain on your desktop for one hour unless you close them. To change the notification display time, select Window>Settings from the menu, and select App Center.

Email Notifications
If you configured the Build Android Application wizard to send email notifications, you receive an email message when your build successfully completes. See Section 4 for an example email notification and how it is used in performing wireless installation of your app onto your devices.

 

4. Wirelessly Installing the Android App on Your Device

If you configured your build process to send email notifications, you will receive an email notification similar to the one shown below.

Build notification containing link to app installation

When you tap the link in the email, the following page appears.

App download page

Tap Download Now, and your app begins downloading onto your device. After downloading the app, view your downloads and touch your app to begin installation.

Note: Do not attempt to open the installer URL in the MobiOne Test Center. Test Center is not able to run binary app files.

 

5. Building for Android Marketplace Distribution

To upload your Android app for distribution through an Android marketplace, such as Google Play or the Amazon Android Store, you must build your application to include digital signature information. The following are the required digital signature files, and you include these when you run the Build Android Application wizard.

Private Key file
The private key (PK) file is created at the same time as the digital certificate file. It is used in the MobiOne application build process to encrypt the key file. This file should be kept safe and private.

Digital Certificate file
An Android application must be digitally signed with a valid digital certificate in order for you to distribute the file via an Android marketplace.

 

5.1 Creating a Digital Certificate and Private Key

To begin, you will create a private key file (PK) and digital certificate file (.cer) using the MobiOne Digital Signing Utility. The signing utility generates both Android and iOS digital signature files simultaneously. The resulting file is a .zip file that you download to your computer. These files are used in the MobiOne application build process. Be sure to store the respective files together; they must be used as a pair when building applications.

5.1.1 Creating a Folder for Storing Certificate Data

Please Read - Before generating any files, here is a little housekeeping advice. Always create a special folder into which the certificate files saved. It is critical that you never mix different versions of the private key and certificate files. Doing so results in errors when you attempt to use the data in the application build process.

5.1.2 Generating Certificate Signing Request and Private Key Files

The first step is to use the MobiOne Signing Data Utility to create certificate and private key files, which you will then download to your development machine. The certificate file is named certificate.cer, and the private key is named private.key. Both files are required for building an Android application for distribution via an Android marketplace. These files are not required as part of the build for ad hoc testing on a device.

The certificate created using the MobiOne Signing Data Utility is a self-signing certificate. Although this is generally accepted for apps submitted to Android Marketplaces, a certificate from a signing authority, such as godaddy.com, is considered more reliable and safer than self-signed certificates.

Note: The process of generating certificate and private key files needs to be done only once.

  1. Using your web browser, access the MobiOne Digital Signing Utility at http://2point0m1.mobionesigning.appspot.com/signing/.
  2. Fill in your company information, and click the Generate button to create both the certificate file and private key file. The company information is used as part of the generated digital signature files.
  3. Generating the certificate and private key files
  4. Click the Download button for the .zip file, and extract the files to the new folder you created in Section 5.1.1. You will use the files found in the Android folder in the Build Android Application wizard.
  5. Downloading the generated .zip file
  6. Build your app again as described in Section 2; however, when you reach the Digital Signature page of the wizard, click the More button to navigate to the digital certificate (.cer) and the private key file (private.key) downloaded from the Digital Signing Utility. Continue the build process as described in Section 2.
  7. Selecting digital signature files

    Notes:

    • The certificate and private key files must be a matching pair; otherwise a validation error appears .
    • If you have a . p12 identity file that was created on a Mac, you can use this file instead by selecting the Identity File and Password option.
  8. When the build is complete, you can submit the resulting .apk file to an Android marketplace for distribution.

See the following sites for information and instructions on publishing your application to make it publicly available:

 

6. Android App Build Checklist

Below are the high level steps for building an Android app for ad hoc testing, and then building for submission to an Android marketplace.

  1. Use the Android Build Application wizard to provide MobiOne with the information needed to build your application.
  2. Install for testing on a device.
  3. Download digital signing files using the MobiOne Digital Signing Utility.
  4. Repeat step 2 to build the app with digital signature information.
  5. Submit your app to an Android marketplace.