Skip to content

Get Started with Antourage Viewer Android SDK

Pre-requisites

For a successful integration please find our requirements below and make sure that you are compatible.

  • Minimum Android SDK: Antourage widget requires a minimum API level of 21;
  • Starting from 0.2.0 version library has migrated to the androidX, so make sure that you have
    android.useAndroidX=true
    android.enableJetifier=true
    
    in your gradle.properties

Install

Add:

    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
and
dependencies {
    ...
    implementation 'com.github.antourage:viewer-sdk-android:{latest_version}}'
}

Initialization

You have to configure AntourageFab singleton before calling other methods, usually in your onCreate() method:

AntourageFab.configure(<context>: Context, <teamId>: Int, <localisation>: String? = null)

Parameters

  • context - Context of your activity or fragment.
  • teamId - The 'ID' that has been assigned to the partner. This 'ID' can be requested from the Antourage partner's account manager.
  • localization - The preferred locale (e.g. "en-US") in which portal should be displayed. If not specified application locale will be used. If locale not supported English will be used.

Add UI part

The main feature of Antourage SDK is the widget — a simple button that should be placed on your screen. The widget will fully work only after successful configuration.

Antourage widget view can be added to the layout programmatically. Example for fragment with FrameLayout as root view:

val antFab = AntourageFab(context)
val params = FrameLayout.LayoutParams(
   FrameLayout.LayoutParams.WRAP_CONTENT,
   FrameLayout.LayoutParams.WRAP_CONTENT
)
params.gravity = Gravity.BOTTOM or Gravity.END
antFab.layoutParams = params
rootView.addView(antFab)

Or you can add antourage widget to xml directly. Example for ConstraintLayout:

<com.antourage.weaverlib.ui.AntourageFab
   android:id="@+id/antFab"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:layout_gravity="end|bottom"
   app:layout_constraintLeft_toLeftOf="parent"
   app:layout_constraintRight_toRightOf="parent" />

Widget's properties

  • portalColor - The color of the portal.
  • nameTextColor - The text color of the content creator or show name label.
  • nameBackgroundColor - The background color of the content creator or show name label.
  • titleTextColor - The text color of the stream name label.
  • titleBackgroundColor - The background color of the stream name label.
  • ctaTextColor - The text color of the call to action button.
  • ctaBackgroundColor - The background color of the call to action button.
  • liveDotColor - The color of the pulsating dot, which is displayed when the content is live.

Also you need to pass your activity's or fragment's lifecycle in onResume() method:

override fun onResume() {
   super.onResume()
   antFab.setLifecycle(lifecycle)
}

If for some reason you can't use lifecycle, you can override both onResume and onPause in activity or fragment that contains widget:

override fun onResume() {
    super.onResume()
    antFab.onResume()
}

override fun onPause() {
    super.onPause()
    antFab.onPause()
}

Push Notifications

Subscription

Subscription and unsubscription is handled by our partners, not by the Antourage dev team. If any of our partners have push notification implemented in their system, they should provide us with the POST endpoint. Antourage backend services will send the following JSON payload to this endpoint:

"data": {
    "title": "some title",
    "param": [
        "some body",
        "some video url",
        "antourage"
    ]
}

Sending notifications

Antourage backend will sends POST request only if new content is available. Sending push notifications is handled by our partners infrastructure.

Handling notifications

By tapping on a Push Notification from Antourage the application should open received video url in web browser. Example how to parse data from push message:

override fun onMessageReceived(remoteMessage: RemoteMessage) {
    remoteMessage.data.run {
        val title = get("title") // notification title
        val params = get("param")
        val jsonParams = JSONArray(params)
        val content = jsonParams[0] // notification body
        val url = jsonParams[1] // url to open in web browser on notification tap
    }
}

Example

To run the example project, clone the Antourage repo, open project in Android Studio and run app module.