Rebar Android App Configuration File

Monkton, Inc.

App Configurations allow for multiple configurations to be generated for an app being built. These configurations can range from endpoints to security configuration settings.

The configuration file is simply named app-config.json, our sample apps include the build scripts and configuration file layout to generate a development, production, and test builds with different configurations.

Structure is as follows:

{project_root}/src/production/assets/app-config.json

{project_root}/src/development/assets/app-config.json

{project_root}/src/test/assets/app-config.json

To automatically embed these into your app for different build types, perform the following changes to your build.gradle file in your project.

sourceSets {
	// Defines how we import the development assets for configuration
	debug {
		assets.srcDirs = ['src/development/assets']
	}
	// Defines how we import the production assets for configuration
	release {
		assets.srcDirs = ['src/production/assets']
	}
	// Defines how we import the test assets for configuration
	test {
		assets.srcDirs = ['src/test/assets']
	}
}

Standard Configuration Settings

These configuration elements are shared between iOS and Android.

API Host

The rebar.api.host field configures the API endpoint in which the App will communicate. This field can also be a Managed App Config pushed down by your MDM.

The rebar.api.host should be the full host name to your api endpoint. This can be retrieved via your Rebar Hub App Page.

If this field is omitted it will cause the app sanity check to fail.

This field is mandatory.

SSL Pinning

The rebar.tls.pinned is a string array of acceptable SHA-512 hashes of the server certificates. These hashes should be generated using the Admin console. The Rebar Hub App app-config.json generator will automatically fill this field out. This field can also be a Managed App Config pushed down by your MDM

SSL Pinning adds another layer of security and verification of certificates when using TLS.

This field is mandatory.

App Permissions

Rebar automatically notifies users what permissions will be prompted upon successful authentication. These permissions are inferred from your app itself.

You will need to prompt users for the permissions you wish to use, like location before using those features. In iOS, the only permission that is automatically prompted is the push permission.

OCSP Enabled

The rebar.useOCSP is a boolean value that indicates to the Rebar SDK that OCSP checks of certificates are enabled. This field can also be a Managed App Config pushed down by your MDM

The Rebar SDK will attempt to perform the OCSP check to validate that the certificate presented from the server is valid and that the certificate chain is valid.

These checks are mandatory through via NIAP FIA_X509_EXT.1.1.

The default value is true.

Continue on OCSP Error

The rebar.continueOnOCSPError is a boolean value that indicates that the OSCP checks, if failed, should be allowed to continue on. OCSP checks can fail if the server cannot be reached. This field can also be a Managed App Config pushed down by your MDM

For more information on the requirements of this flag please consult NIAP FIA_X509_EXT.2.2.

The default value is false.

Continue on OCSP Signing Missing

The rebar.continueOnOCSPSigningMissing is a boolean value that indicates that the OSCP checks, if missing the OCSP Signing OID, should be allowed to continue on. This field can also be a Managed App Config pushed down by your MDM

For more information on the requirements of this flag please consult NIAP FIA_X509_EXT.2.2.

The default value is false. `

Android Specific Settings

Android GCM Values

The rebar.gcm.id is a string value that indicates the GCM identifier for this application.

The default value is null.

Android GCM Values

The rebar.gcm.handler is a string value that for the fully qualified name (package and class name) of the GCM handler to handle GCM callbacks within the application.

The default value is null.

Customizing Rebar UI

The Rebar "Bootstrap" UI can be updated with three customization sections. This includes the activities, the buttons, and the button text.

To change activities, define a custom drawable that defines your desired customizations. For instance, a custom drawable named drawable/rebar_activity_override.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@color/colorAccent"/>
</shape>

To leverage this drawable, add this to your app-config.json file:

"rebar.drawable.activity": "rebar_activity_override"

To change buttons, define a custom drawable that defines your desired customizations. For instance, a custom drawable named drawable/rebar_button_override.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@color/colorAccent"/>
</shape>

To leverage this drawable, add this to your app-config.json file:

"rebar.drawable.button": "rebar_button_override"

Finally, the color of text can be changed for text on the screen. Define a custom color in the values/colors.xml file:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#3F51B5</color>
    <color name="colorPrimaryDark">#303F9F</color>
    <color name="colorAccent">#FF4081</color>
    <color name="orange">#FF5722</color>
</resources>

To leverage this drawable, add this to your app-config.json file:

"rebar.color.text": "orange"

Failure for these resources to be found will default to the Rebar default colors.

App Splash Screen

For the app startup, a layout can be defined by the app and the app-config.json that will display the desired layout. This will act as the startup screen that is displayed while the Rebar bootstrap process is going on.

To set this, add the rebar.startup.layout key with the name of the layout to display. If the layout does not exist, a default blank layout will be presented.

"rebar.startup.layout": "launch_layout"

App Welcome Screen

The rebar.screen.welcome is an optional string value that maps to the class name of a custom welcome screen. This screen will present the user with a custom view that welcomes them to the app. The screen should implement the Rebar method calls to create accounts or login.

If this value is set, Rebar will instantiate and create the welcome screen.

The default value is null.

After defining your custom welcome screen, you can invoke the code below to launch the login screen:

// Ensure we aren't logged in
if (!AppController.instance.isLoggedIn) {
   activity.startActivity(Intent(activity, AppController.instance.config!!.loginActivityClass))
}

Main App Screen

The rebar.screen.main is an optional/mandatory string value that maps to the class name of the main user interface for this app.

If this value is set, Rebar will instantiate and create the main screen.

The default value is null.

App Logo

The rebar.app.logo is an optional string value that maps to the name of an image set (iOS) or image resource (Android). When no welcome-screen is set, this image will be set for the welcome screen.

The default value is null.