Skip to content

Android SDK

Prerequisites

The following examples is tested in the following conditions:
Android Studio 3.4.2
Android SDK Tools 26.1.1

And the SDK is running with following SDK levels.
minSdkVersion 21
targetSdkVersion 28 Example

android {
  compileSdkVersion 28
  buildToolsVersion “26.1.1”

  defaultConfig {
    applicationId “se.overbliq.MyApplication"
    minSdkVersion 21
    targetSdkVersion 28
  }
} 

Installation

You can setup your project in two different ways:
1. You can use a script to get a sample app up and running in a couple of minutes.
2. You can configure your installation manually by adding the OVERBLIQ™ Android libraries separately. This is if you want to just include specific features and not use the default application and activities provided. If you want to integrate OVERBLIQ™ features in your current app, use the second tutorial.

Setup using a script (Simplest way to get started)

If you follow these steps you will get up and running in no time. When complete, the signing config is configured and the app is ready to be pushed to Google Play.
1. Download the startup shell script
2. Run script with ./startProject.sh [App name] [OVERBLIQ™ Services Environment] [Google Maps API key v3]
Example:

./startProject.sh MyOverbliqApp https://myapp.overbliq.com AIzaSyAlO...
  1. Start the app with Android Studio, if OVERBLIQ™ Services is up and running you will see the default theme of a OVERBLIQ™ application
  2. Run ./gradlew bundleRelease to bundle app for deploying to Google Play.

What to do now

Now you have a working android application to your current OVERBLIQ™ Services backend.

Change icon. Use android studio and right click in on root project and click add image asset and name it ic_launcher (the default name)

Enable features in your appConfig.xml file, you can see all features in the appConfig.xml file in OVERBLIQ™ android sdk.

You can adjust layout files by overwriting existing xml layout files in OVERBLIQ™ android sdk. Simplest way to do that is to copy the file you want to adjust to your project and edit it.

While editing the xml layout file, things to think about. Some views cannot handle removing an element with an id and some can handle it, so if you want to remove for example an image in a link layout you can try to remove the element with the id imageUrl, if the app crashes you can put the image in a hidden framelayout.

How do i know which file to copy and edit. Look att wich format the view you want to change has and then look in one of the following packages "se.overbliq.lib.componentFormats" "se.overbliq.ui.formats" (for now) in those packages it should be format classes extending AbstractFormat with a variable formats containing a list of formats to hook that class up to. When you find your format you can see wich layout files is inflated in that format.

Little more advanced things you can do is to overwrite default spashscreen or mainactivity. This is done by overwrite variables in your OverbliqApplication file,

override var mainClass: KClass<out OverbliqMainActivity> = MainActivity::class
override var splashClass: KClass<out AppCompatActivity> = Splash::class

and changing the applications activities in your manifest file.

Manual setup not using a script

  1. Add repository to the file build.gradle in your Android Studio project.
repositories {
    maven {
        url 'https://nexus.sisyfosdigital.se/repository/maven-releases/'
    }
}
  1. Add your dependencies to build.gradle, with the OverbliqTools you will only get the necessary classes to connect to OVERBLIQ™ Services. With android-widgets you can use ready-to-use views and activities. (The simple method above use widgets and extend OverbliqApplication for the application in the manifest)
dependencies {
    implementation group: "se.sisyfos.mobile", name: "android-overbliqTools", version: "<project.sdkVersion>"
}
dependencies {
    implementation group: "se.sisyfos.mobile", name: "android-widgets", version: "<project.sdkVersion>"
}
  1. Add the following XML resource file to configure for your instance of OVERBLIQ™ Services. Link to example application configuration

Once you edited all necessary configurations in appConfig.xml you should be ready to go.
Example of mandatory configuration:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="getServices" translatable="false">{site-name}/config-service/services</string>
    <string name="google_maps_key" templateMergeStrategy="preserve" translatable="false"> </string>
</resources>

When completing all steps in the manual setup, it's up to you which content from the OVERBLIQ™ Android SDK you want to use.
- To use all default behaviours at this stage you only need to extend OverbliqApplication().
- You can use just views or fragments from the SDK as well. See Overview to see different methods for doing this.
- If you only used android-overbliqTools in the dependencies configuration you can use the providers to access
OVERBLIQ™ Services objects. More info

Congratulations you are now an OVERBLIQ™ Android Developer.