Skip to content
Shiva Kumar H R edited this page Mar 13, 2018 · 7 revisions

Short Name

Develop Enterprise-grade Hybrid Mobile App with Cloud-native Backend.

Short Description

Develop a Secure, Enterprise-grade Ionic/Cordova based Hybrid Mobile App that connects to CouchDB/Cloudant and ObjectStorage via IBM Mobile Foundation service.

Offering Type

Cloud

Introduction

When developing enterprise mobile apps that you and your organization foresee as solving important business problems for your customers/employees, the time to market is critical. You want to develop the apps as quickly as possible and get them into production. At the same time, you want the make sure that your organization’s data, APIs, and mobile apps are secure, and that the mobile back end can seamlessly scale to a large number of mobile users. In this developer code pattern, we show you how to leverage open source technologies, such as Apache Cordova and the Ionic Framework, and cloud services such as Cloudant® NoSQL database, IBM Cloud Object Storage, and IBM Mobile Foundation to quickly develop and host secure, scalable enterprise mobile apps.

Author

By Shiva Kumar H R

Code

https://github.com/IBM/Ionic-MFP-App/

Demo

https://youtu.be/SjM3aVRvGWQ

Video

https://youtu.be/SjM3aVRvGWQ

Overview

When developing your enterprise mobile app that needs centralized hosting of data, use of cloud-native services such as Cloudant No-SQL Database for storing textual data and Cloud Object Storage service for storing image/video/audio data, allows you to quickly go from idea-conception to reality. The Mobile Foundation service available from IBM Cloud provides a scalable mobile access gateway for securely accessing those backend services, and it provides other essential mobile backend capabilities such as push notifications, app lifecycle management and app analytics.

This code pattern gives you step by step instructions for developing an Ionic/Cordova based hybrid mobile app that securely connects to Cloudant and Object Storage services via IBM MobileFoundation (aka MFP) service.

When you have completed this pattern, you will understand:

  • How to authenticate users (through preemptive login) using MFP security adapter.
  • How to write an MFP adapter that authenticates with Cloud Object Storage service and pass back the Authorization token to the mobile app.
  • Recommended architectural patterns for coding the interaction between mobile app and Cloud Object Storage service.
  • How to use imgcache.js in Ionic app for caching images fetched from Cloud Object Storage service.
  • How to show Google Maps in Ionic app as well as capture user’s geo-location & image from camera.
  • How to upload the captured image from mobile app to Cloud Object Storage service.
  • How to fetch data from Cloudant service to mobile app via MFP adapter as well as post new data to Cloudant.
  • How to customize the Ionic app logo and splash, and build the release apk for uploading to public/private app stores.

Flow

Architecture diagram
  1. User launches the mobile app, enters his/her credentials on the login screen and clicks Login.
  2. Mobile app sends the user credentials to MFP server for validation.
  3. MFP server invokes the security adapter logic to validate user credentials and returns an appropriate response to the mobile app. For the sake of this demo, we will use a simple security adapter that returns success when password equals username.
  4. If user authentication succeeds, mobile app proceeds to show the home page. As part of this, it makes a call to MFP adapter to fetch the data from Cloudant NoSQL database.
  5. MFP adapter fetches the data from Cloudant and returns it to the mobile app. The data fetched from Cloudant will have references to the images stored in Cloud Object Storage.
  6. Mobile app makes a call to MFP adapter to get the Authorization token for interacting with Cloud Object Storage service.
  7. MFP adapter makes a call to Cloud Object Storage service's token manager endpoint to get the Authorization token and returns it to the mobile app.
  8. Mobile app initializes image-caching plugin and asks it to use an HTTP header of Authorization=<value returned from MFP adapter> while fetching images. Mobile app displays the data obtained from MFP adapter as a list of items. The image caching plugin running on the mobile app downloads and caches images from Cloud Object Storage.
  9. User clicks on one of the list item to see more details. A detail page is shown consisting of image and geo-location marked inside Google Maps.
  10. Back in the home page, user clicks on + button to report a new civic problem. A new page is shown where user can enter a description for the new civic problem as well as capture image and geo-location of the problem spot. User clicks on Submit button.
  11. Mobile app uploads the textual data to Cloudant NoSQL DB via MFP Adapter.
  12. Mobile app creates a thumbnail image by resizing the captured image and uploads both the captured image and thumbnail to Cloud Object Storage.
  13. Other users who click on refresh button on the home page (and those who log in afresh) are shown the updated list of problem reports.

Included components

  • Cloudant NoSQL DB: A fully managed data layer designed for modern web and mobile applications that leverages a flexible JSON schema.
  • Cloud Object Storage: A highly scalable cloud storage service, designed for high durability, resiliency and security.
  • Mobile Foundation: A scalable mobile access gateway powered by the market-leading IBM Mobile Foundation Technology. The service offers a comprehensive set of mobile backend capabilities such as, App life cycle, Push, Analytics, Feature Toggle, Security and Authentication and offline synch.

Featured technologies

  • Mobile: Systems of engagement are increasingly using mobile technology as the platform for delivery.

Blog

Speeding up development of your enterprise mobile apps using open source technologies and cloud services

Links