Runtime Connector

Introduction to the Runtime Connector Service

The Runtime Connector service allows you connect your mobile apps to your own back-end API servers.

  • Bind your mobile client to custom back-end API services and business logic

  • Ability to add custom configuration for a back-end service, which becomes accessible from your Mobile App

Prerequisites

Setting Up the Runtime Connector Mobile Service

Provisioning the Custom Runtime Connector Service

Prerequisites

To provision the Custom Runtime Connector mobile service:

  1. Log into the OpenShift console.

  2. Create a new project or choose an existing project.

  3. Click Add to Project and choose Browse Catalog from the options.

    You can filter the catalog items to only show mobile specific items by clicking the Mobile tab.

  4. Click Services and choose the Custom Runtime Connector service.

    catalog mobile services
  5. Follow the wizard for provisioning that service.

    If prompted to Create a Binding, choose Do not bind at this time

When prompted, enter the following:

  • Service Name (required): Service name to be exposed to the mobile application.

  • Service URL (required): Service url where the service is running.

  • Service JSON Configuration: Service configuration in a valid JSON format.

Once the wizard steps are completed, navigate to the Project Overview in OpenShift to see the newly provisioned service.

Binding a Mobile Client with the Custom Runtime Connector Service

To use mobile services, you must represent your mobile app in OpenShift using a Mobile Client, and that Mobile Client must be associated with the mobile service. This association is called binding and once it’s done, your mobile app can use that service immediately.

The association between a Mobile Client and Custom Runtime Connector Service uses the Service Broker bind feature.

To associate a Mobile Client with a mobile service:

Procedure

  1. Navigate to the Overview of your OpenShift project.

  2. Click on the Mobile Client and navigate to Mobile Client view.

    Your mobile app will be represented by two items in OpenShift, an item in the Mobile Clients list and an item in the Provisioned Services list. Make sure to click on the item in the Mobile Clients list.
  3. Navigate to Mobile Services tab.

    mobile clients services all unprovisioned
  4. Click Create Binding and follow the Create Binding wizard to associate the Mobile Client with the Custom Runtime Connector Service.

  5. Fill out the binding parameters required by the Custom Runtime Connector Service.

After the binding is finished, the Mobile Client has been updated with the custom configuration.

Using Runtime Connector in an App

Retrieving the Custom Configuration in a Mobile Client

This section shows how to retrieve the configuration of the custom service in a Mobile Client by using the Core module of the Aerogear SDK.

Android
  1. If you do not use any other modules of the Aerogear SDK, make sure that the android-core is in the dependencies of your app module’s build.gradle:

    dependencies {
        implementation 'org.aerogear:android-core:1.0.0'
    }
  2. Use the getServiceConfigurationById method to get the service configuration associated with your custom service:

    ServiceConfiguration customConfig = MobileCore.getInstance().getServiceConfigurationById("[SERVICE NAME]");
  3. Get the URL of the custom service:

    String url = customConfig.getUrl();
  4. Get custom configuration properties (specified in Service JSON Configuration at provision time):

    String property = customConfig.getProperty("[PROPERTY NAME]");
iOS
  1. If you do not use any other modules of the Aerogear SDK, make sure that the AGSCore is in your Podfile:

    target :'YourTarget' do
        pod 'AGSCore', '1.0.0'
    end
  2. Use the getConfigurationById function to get the service configuration associated with your custom service:

    let customConfig = AgsCore.instance.getConfigurationById("[SERVICE NAME]")
  3. Get the URL of the custom service:

    let url = customConfig.url
  4. Get custom configuration properties (specified in Service JSON Configuration at provision time):

    let property: JSONValue = customConfig.config["[PROPERTY NAME]"]
Cordova
  1. Use the getConfigById function to get the service configuration associated with your custom service:

    const core = require("@aerogear/core").INSTANCE;
    const customConfig = core.getConfigById("[SERVICE NAME]");
    @aerogear/core is a dependency of @aerogear/app which should always be installed because it contains the `init`function to initialize all other SDK modules.
  2. Get the URL of the custom service:

    const url = customConfig.url;
  3. Get custom configuration properties (specified in Service JSON Configuration at provision time):

    // customConfig.config contains the parsed Service JSON Configuration
    const property = customConfig.config["[PROPERTY NAME]"];
Xamarin
  1. Use the GetServiceConfigurationById function to get the service configuration associated with your custom service:

    var customConfig = MobileCore.Instance.GetServiceConfigurationById("[SERVICE NAME]");
  2. Get the URL of the custom service:

    var url = customConfig.Url;
  3. Get custom configuration properties (specified in Service JSON Configuration at provision time):

    var property = customConfig["[PROPERTY NAME]"];