Hybrid Mobile Apps: Using the Mobile Cloud Service JavaScript SDK with JET by Peter Flies

Posted: September 27, 2016 in Cloud, JDeveloper & ADF, Mobile
Tags: , , , , , , , , ,

image

Introduction

Oracle’s Mobile Cloud Service has a Javascript SDK that makes connecting your hybrid mobile app to your mobile backend service a breeze.  The Javascript SDK for MCS comes in two flavors, one for web applications and one for Cordova applications. The MCS Javascript SDK for Cordova has a few more capabilities than the web version, such as methods for registering a device and notifications.  However, for the most part the two SDKs are quite similar. For creating hybrid mobile apps, choose the Cordova SDK.

To download the Javascript SDKs for MCS, login to your MCS instance and click on the “Get Started” page. This page has SDK downloads for native apps in Android, iOS, and MCS Javascript SDKs. You can download the SDK with a starter app or choose to download the SDK alone and add it to an existing project. For the example in this post, I downloaded the SDK by itself and added it to a project created using Oracle JET (Javascript Extension Toolkit). To get started with Oracle JET, follow the Get Started link on the JET home page.

The steps below include one way to connect the hybrid app to Mobile Cloud Service using the MCS JavaScript SDK. I will cover making calls to MCS for authentication and uploading a picture taken on the device to the MCS Storage repository.

NOTE: This example uses the camera plugin of Cordova. To test this on iOS the sample app will have to be run on an actual iOS device, since the iOS simulator does not have a camera. For Android, the emulator does have a camera, so on Android either a device or emulator will work.

Main Article

To get started, use the handy Oracle JET generator to stamp out a mobile app template. The generator can be installed used npm. Using Yeoman, the app template can be created for whatever platform you wish to use. The steps in this post will focus on Android primarily, but also work with iOS hybrid apps.

Install JET generator

To generate a hybrid mobile starter application, the Yeoman generator for Oracle JET must be installed. Use npm to install “generator-oraclejet”. Again, note that on Mac you may need to use sudo.

?

npm install -g generator-oraclejet

To verify the generator was installed, run the following command:

?

npm list -g generator-oraclejet

Scaffold a Mobile Application

Using Yeoman, the JET generator can scaffold three different types of starter applications. This example will use the “navBar” template. To see screens of the options, follow this link.

Open a command prompt and create a directory where you want your mobile application to reside. Change directory to that new folder and run the Yeoman command to create an Oracle JET application. The command below creates a hybrid app named “JETMobileDemo” using the “navBar” template. Note that if on Windows, the platforms option cannot include iOS. On Mac you can use both iOS and android. Read the complete article here.

WebLogic Partner Community

For regular information become a member in the WebLogic Partner Community please visit: http://www.oracle.com/partners/goto/wls-emea ( OPN account required). If you need support with your account please contact the Oracle Partner Business Center.

Blog Twitter LinkedIn Forum Wiki

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s