Browse Category by Oracle Mobile Platform
View Post

Oracle MAX: Building my first application (Part 2): Application development

In the last release of Oracle Mobile Cloud Service, Oracle Mobile Application Accelerator (Oracle MAX) and Location Services were released. In my first technical post about MCS 2.0 I am going to focus on Oracle MAX, the new tool that allows us to create applications without coding, and that will enable business users, and people that doesn’t know about programming, to build applications easily.

This is a 2 part post where you can find:

In the first part of this post we built a Custom API that we will consume from Oracle MAX.

In order to access Oracle MAX, In Oracle MCS applications menu, we have to click on Mobile Applications.

If we want to allow a business user to access Oracle MAX we need to asign them MobileEnvironment_BusinessUser role. Any other user should not have this role as it will not be allowed to access Oracle MCS itself.

This is what we will see the first time we log into Oracle MAX. As we don’t have any application, we can just create a new one.

Once we click on New Application, we will see the first wizard. We have to set the name of the application. This is the name that we will see in our device.

The next step is to define the layout among the predefined ones.

In the next step we are going to set a name to that screen, in this case it will be Posts.

The last step is to define wat we want to see in that screen. we can choose from empty screen (we will be able to add any component), list, form and dashboard.
We are going to pick list in this example.

Once we have finished the wizard, we can see that our screen is based on what we selected in the last step of the wizard, and now we can make some actions on it that we can see on the right hand side of the page.

We are going to start with Add Data. This will allow us to associate data to the list component.

In this step we just have to click on Add Service and look for the API we want to consume.

After we have selected the API, we can choose the business object that we proviously created. This appears as we create getPosts schema.

We have to drag and drop the desired fields into the list items. We can see a preview by clicking on the button. 

After associating the data to a component, we will see a menu on the left where we can choose user, evironment information, or setting a fixed value to set as query parameter if the endpoint we are consuming has a parameter,

We have just finished our first screen.
Now we are going to add a detailt screen were we will be able to check the information on a single post.

In we click on Add a Detail Screen  we will see a wizard like the one we filled when creating the first screen.
After that we will see this page, this is the designer page where we can do:
  • Add Components: we can choose lists, forms, charts, etc.
  • Add Actions: we can define actions and add gestures to our page.
  • Modify properties

How we develop the second screen? Well this is easy, just follow the wizards as we did with the first screen.

Once we have finished the application we can deploy it to our device (the second button) or test it right in the browser (the first button).
If you want a user to deploy the applications you need to set that use ‘Max Application Deploy’ role.

If we click on deploy button, Oracle MAX will start building our application and once it is finished we can see the QR code to download the application.

In order to install the application in our devices we need to have installed Oracle MAX application.
It can be downloaded from Google Play Store or Apple App Store.
This is what Oracle MAX application looks like.
We can click on Edit button to remove the existing aplications or click on add button to add our Oracle MAX applications.
Once we have added our application, scanning the QR code, we will see the posts lists.

And the post detail if we tap in the post.

View Post

Oracle MAX: Building my first application (Part 1): Custom API design

In the last release of Oracle Mobile Cloud Service, Oracle Mobile Application Accelerator (Oracle MAX) and Location Services were released. In my first technical post about MCS 2.0 I am going to focus on Oracle MAX, the new tool that allows us to create applications without coding, and that will enable business users, and people that doesn’t know about programming, to build applications easily.

This is a 2 part post where you can find:

Before that any user can create an application we have to design correctly our Custom API.

Oracle MAX uses business object, so first we need to define schemas for the endpoints.

In this quick example, in our Custom API we are going to have 2 endpoints

/posts that will return a list of all posts, and
/post/id that will give us the information of the post.

Now that we have our endpoints create we have to create schemas for them.
In the left hand side menu, we have to click on ‘Schema’, and if we don’t have any schema yet, click on ‘New Schema’ button.
The first one is Post schema.
This is the base schema for the post object. Now we need to create a schema for every endpoint. 
For /posts endpints we will have getPosts


And for /posts/id endpoints we are going to create getPost schema.
The first step is completed. Now we need to associate the schema to each endpoints and create Mock Data in the responses to each endpoint.
At the moment it is mandatory, and if you don’t have mock data you will not be able to create lists in the application. I would like to thanks Denis Tyrell and Laura Akel for their help with this issue.
For each endpoint we have to click on methods.
Then in responses we have to select the schema that corresponds to the endpoint by adding new Media Type.
And also adding mock data in examples tab.
Our first endpoints is finished, and our second endpoints will looks like:

The last step is to publish the API, because we will not be able to consume it if it is not published.
In API menu, right click on the desired API and click on Publish.
I am not going to implement the APIs as you cna check other posts like Post 1, Post 2, Post 3 or OTN Article. Implementation and design should be done by someone with development skills,
In the next post we will build the application itself and this step can be done by anyone, as the application development is based on wizards and we don’t have to write any line of code.
    View Post

    Oracle MCS: Creating PDF files in Custom APIs

    Oracle Mobile Cloud Service allows you to implement Custom API using node.js. This is a powerful feature as it allows you to use any of the existing node.js modules in your implementation.

    In this post I am going to show you how to create and download a PDF file that will contain the weather information for the provided city, that we will get calling a REST Connector.


    If you don’t know how to create a REST Connector check this post: Oracle Mobile Cloud Service: Create an API that calls a REST web service

    First we need to create a connector. This is the URL we are going to use:

    http://api.openweathermap.org/data/2.5/forecast/daily
    Openweathermap is a free rest api where we can get the weather forecast.

    We have to create some rules as we need to pass some parameters into the url. These are default values that we can override when calling the connector.

    The next step is to create a Custom API.
    We are going to allow annonymous calls to make it easier.

    We need an endpoint with a parameter. This enpoint will have a GET method.

    The last step is to implement our Custom API.
    Now we need to download the JavaScript Scaffold.
    At this point you need to have node.js installed (You can donwload if from this link)
    After that we need to install pdfkit module.
    Before executing ‘npm install pdfkit’ you need to be in the folder where package.json is.
    After that node_modules folder will be created.
    The next step is to edit package.json file to add the dependencies.
    We need to add pdfkit and also we have to add the connector in oracleMobile dependencies.
    PDFKit allows us to create PDF files and add text, images vector graphics, links, etc to our pdf.
    In this example I am just creating one line (line 41) and inserting text based on the values returned by the connector.
    We cannot test the API in MCS tester as the file cannot be downloaded, but we can use postman to do it.
    We can see that the downloaded pdf contains Munich weather information for the next 3 days.

    View Post

    Oracle MCS 16.2.3 (v2.0) realeased. MAX and Location Services are now available

    Oracle Mobile Cloud Service 16.2.3 (v2.0) has been released. This is the second major release in less than 1 year (Oracle MCS was released in July 2015). Although not every MCS instance has this new version, we can already see what’s new in it.

    • Location Based Services
    We are now able to present information based on the location or preferences of the user. Thanks to the Location API we can get information about the location devices, assets and places.
    Location Device is any device that provices location services, for example a beacon.
    Currently Oracle MCS provides support for this protocols:
      • Altbeacon (Open Source)
      • Google’s Eddystone
      • Apple’s iBeacon
    The second one is a Place  that is a physical location that you can associate with a device.
    And the last one is an Asset. This is a mobile object that can be also associated with a location device.
    Oracle MCS provides a REST API using the following endpoint “/mobile/platform/location/devices”
    • Oracle Mobile Application Accelerator (Oracle MAX)
    Although I already had the chance to see what Oracle MAX offered back in January in a Workshop in Madrid, I was exited to see new features that MAX provides since then.
    Oracle MAX is a Rapid Mobile Application Development (RMAD) tool that help us to build applications easier and faster. This tool allows business users and non developers to build applications.
    It provides a development based on wizards where we can define the layout, selecting one from the predefined layouts and building each of the screens using components like lists, froms or charts consuming the APIs we have designed and implemented in Oracle MCS.
    At this point we have to download Oracle MAX application that is available in Google Play Store and Apple App Store and scan the generated QR.
    Who knows what features will bring future versions but it would be great if we will be allowed to download the source code to improve and extend those applications. 
    • More features
    Other new features included in this version are new Security Policies for REST Connectors (Oauth and JWT) and we can also allow the users to login into the apps using their Microsoft Azure Active Directory by configuring it as an identity provider.
    More posts will come in the next few weeks, stay tuned!
    You can get more information in this link: What’s New in Mobile Cloud Service?
    View Post

    Oracle MAF: Oracle MCS as authentication provider

    An usual requirement when working with Oracle Mobile Application Framework and Oracle Mobile Cloud Service is implement the login against Oracle MCS.
    In this post I am going to show you how to configure Oracle MCS as an authentication provider in Oracle MAF.

    • Creating a Realm
    A realm is a security context for a ser of users. We can have only one realm for each Mobile Backend, but we can have multiple Mobile Backend using the same realm.
    Using one or more realm in MCS will depend on what users we will like to give access to our application.
    Under Applications, we can find Mobile User Management. By default there is one realm named ‘default’, but we can create a new one by clicking on ‘New Realm’ button.
    In the realm we can find some user information by default altough we can add more properties.

    • Create and configure a Mobile Backend
    A Mobile Backend (MBE) is the gateway to Mobile Cloud Service. If we want to access any available resource from MCS, for example an API, we have to do it though an MBE.

    We can find Mobile Backends option under Applications menu option.

    Click on ‘New Mobile Backend’ to create a new one.

    Once you have created the MBE head to Users option and click on ‘Change user realm’, by default the MBE has a realm but in this case we need to set the new realm we have just created. This is not the case, but we can also set a default realm for every new created MBE.

    In the popup we can select any existing realm.

    After that, as there is no users in the realm you can add them by clicking on ‘Add New User’ button.

    You will receive an email to the email address you used to register the user.
    • Configuring a MAF Application.
    The last step is to configure the MAF application. Here is a couple of things that we have to do.
    First we need to create a secured page. We can do it in maf-feature.xml
    The last thing is to configure the login server.
    To do this, we need to open maf-aplication.xml. We can find the file in ‘Application Resources’ under descriptors/ADF META-INF folder.
    Click on the add button.

    In the popup we have to select HTTP Basic as Authentication type and set a name to the connection.

    In HTTP Basic tab we need to configure login and logout URLs.
    To build this URLs we need to know the base URL, and add to it at the end ‘/mobile/platform/users/login’ in Login URL and “/mobile/platform/users/logout” in Logout URL.
    We can check the base URL in MBE Settings menu option.

    The last step in the cofiguration is to add a custom header. The header name will be ‘Oracle-MobileBackend-ID’ and the value can be also found in MBE Settings menu option.

    We just have to execute the application. As soon as we do it, the login page will appear.
    If we set the right credentials we will access our secured page.
    But if we enter wrong credentials we will se a’Invalid username or password.’ error message.