Skip to content

Integrate live blog, analytics and real time data services into your Android client applications with speed and efficiency. Our Android SDK helps you focus on the client's implementation of booting, configuring live blog and sending events.

Notifications You must be signed in to change notification settings

stationfy/Arena-SDK-Android

Repository files navigation

Arena Android SDK

Integrate live blog, analytics and real time data services into your Android client applications with speed and efficiency. Our Android SDK helps you focus on the client's implementation of booting, configuring live blog and sending events.

Requirements

  • Minimum Android SDK: Arena Sdk requires a minimum API level of 21.
  • Compile Android SDK: Arena Sdk requires you to compile against API 29 or later.

Sample

A sample application is available that showcases the majority of the features offered by the Arena SDK.

Liveblog

Integrate the live blog in real time into your Android client applications with speed and efficiency. Our SDK helps you focus on the client's implementation of initializing, configuring and displaying the live blog. Displays all card types in live blog format. We currently support the following cards:

Card Title

Title

Description

Description

Title And Description

Complete

Publisher

Publisher

Pinned

Pinned

Summary

Summary

Player/Person

PlayerAndPerson

Golf

Golf

Article

Article

Social

Social

Video

Video

Step 1: Create a live blog from your dashboard

Ask your account manager for your publisher slug

Step 2: Install the Live Blog SDK

Installing the Live Blog SDK is simple if you’re familiar with using external libraries or SDKs. To install the Live Blog SDK using Gradle, add the following lines to a build.gradle file at the app level.

repositories {
    mavenCentral()
}

dependencies {
    implementation 'im.arena:liveblog:1.30.0'
}

Step 3: Configure ProGuard to shrink code and resources

When you build your APK with minifyEnabled true, add the following line to the module's ProGuard rules file.

-keep class im.arena.liveblog.** { *; }
-keep class im.arena.analytics.** { *; }
-keep class im.arena.commons.** { *; }
-keep class im.arena.realtimedata.** { *; }

Step 4: Setup SDK

Initialization links the SDK to the Android context, allowing you to respond to connection and status changes. The LiveBlog.setup() method must be called once across your Android client app. It is recommended to initialize the in the onCreate() method of the Application instance.

LiveBlog.configure(APPLICATION)
  • APPLICATION: Base class for maintaining global application state.

Step 5: Start SDK

To initialize the sdk it is necessary to add the LiveBlog in the xml:

<im.arena.liveblog.LiveBlog 
        android:id="@+id/live_blog"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

And start the event watcher by passing the following parameters:

live_blog.start(PUBLISH_SLUG, EVENT_SLUG, LIFECYCLE_OWNER, CLICK_LISTENER)
  • PUBLISH: The publisher slug will be provided by Arena.
  • EVENT_SLUG: Live blog identifier
  • LIFECYCLE_OWNER: A class that has an Android lifecycle. These events can be used by custom components to handle lifecycle changes without implementing any code inside the Activity or the Fragment.
  • CLICK_LISTENER: Interface definition for a callback to be invoked when a view is clicked.

Chat

Arena provides a ready-to-use live group chat activity that doesn't require
any development effort and it can power many of the common scenarios.
For more complex use-cases we made available the Kotlin SDK that
provides the infra-structure necessary to build your own chat experience
and at the same time leverage the powerful moderation and backoffice
tools available at the Arena Dashboard.

Step 1: Install the Chat SDK

Installing the Chat SDK is simple if you’re familiar with using external libraries or SDKs. To install the Chat SDK using Gradle, add the following lines to a build.gradle file at the app level.

repositories {
    mavenCentral()
}

dependencies {
    implementation 'im.arena:chat:1.0.0'
}

Step 2: Configure ProGuard to shrink code and resources

When you build your APK with minifyEnabled true, add the following line to the module's ProGuard rules file.

-keep class im.arena.chat.** { *; }

Step 3: Setup SDK

To initialize the SDK, you'll need the SITE_ID and ROOM_ID, both available in the Arena Dashboard or using the Platform API.

You can find your site's slug in the dashboard settings: https://dashboard.arena.im/settings/site.

After retrieving the SITE_ID and ROOM_ID, you need to call ArenaChat(SITE_ID, ROOM_ID). This method should be called once in your Android client application. It's recommended to initialize the Activity's onCreate() method.

 setContent {
     ArenaChat(SITE_ID, ROOM_ID)
}

The chat has additional settings that allow clients to view event logs in the terminal, as well as change the running environment:

 setContent {
     ArenaChat(SITE_ID, ROOM_ID, Environment.DEVELOPMENT)
}

The chat internally uses Android's Compose, which allows customers to add and customize the screen where the chat will be embedded. To do this, you need to add the chat to a view in your app, for example:

setContent {
    // In here, we can call composables!
    MaterialTheme {
        Greeting(name = "compose")
    }
}

After these steps, the chat will be up and running in your app.

Analytics

Analytics helps you measure your users, product, and business. It unlocks insights into your app's funnel, core business metrics, and whether you have product-market fit.

Step 1: Install the Analytics SDK

Installing the Analytics SDK is simple if you’re familiar with using external libraries or SDKs. To install the Analytics SDK using Gradle, add the following lines to a build.gradle file at the app level.

repositories {
    mavenCentral()
}

dependencies {
    implementation 'im.arena:analytics:1.21.1'
}

Step 2: Configure ProGuard to shrink code and resources

When you build your APK with minifyEnabled true, add the following line to the module's ProGuard rules file.

-keep class im.arena.analytics.** { *; }
-keep class im.arena.commons.** { *; }
-keep class com.google.firebase.iid.** { *; }

Step 3 : Setup SDK

The Analytics.configure() method must be called once across your Android client app. It is recommended to initialize the in the onCreate() method of the Application instance.

Analytics
    .environment(Environment.PRODUCTION)
    .logLevel(LogLevel.NONE)
    .configure(CONTEXT, WRITE_KEY)
  • CONTEXT: Base class for maintaining global application state.
  • WRITE_KEY: The write key is the one used to initialize the SDK and will be provided by Arena team

The analysis service offers some types of metrics:

TRACK

The track() call is how you record any actions your users perform, along with any properties that describe the action.

Each action is known as an event. Each event has a name, like Subscribed, and properties, for example a Subscribed event might have properties like plan or couponCode

Analytics.instance().track("Post Reacted", 
        hashMapOf<String, String>().apply {
            put("postId", "WOR06DvfpcRaylQJoZe")
            put("reaction", "thumbs_up")
})
  • EVENT: The name of the event
  • PROPERTIES: Additional properties that can be sent together with the event
PAGE

The page() call is how you register the screens that your users see, along with the properties that describe the action.

Analytics.instance().page("Home", 
        hashMapOf<String, String>().apply {
            put("postId", "WOR06DvfpcRaylQJoZeu")
            put("reaction", "thumbs_up")
})
  • SCREEN: The name of the screen that was viewed
  • PROPERTIES: Additional properties that can be sent together with the event
IDENTIFY

identify() lets you tie a user to their actions and record traits about them. It includes a unique User ID and any optional traits you know about them like their email, name, etc.

We recommend to call identify in these situations:

  • After a user registers or log in
  • When a user updates their info
  • After loading a page that is accessible by a logged in user
Analytics.instance().identify("43564gfdrtysdg34234", 
        hashMapOf<String, String>().apply {
            put("name", "John Doe")
            put("email", "john@nocompany.com")
            put("plan", "business")
})
  • USER_ID: Unique User ID
  • TRAITS: Optional traits you know about them like their email, name, etc.

RealTimeData

Using this mode you're controlling how the date will be displayed entirely on your side, we will provide a data stream with all information.

Step 1: Install the RealTimeData SDK

Installing the RealTimeData SDK is simple if you’re familiar with using external libraries or SDKs. To install the RealTimeData SDK using Gradle, add the following lines to a build.gradle file at the app level.

repositories {
    mavenCentral()
}

dependencies {
    implementation 'im.arena:realtimedata:1.40.0'
}

Step 2: Configure ProGuard to shrink code and resources

When you build your APK with minifyEnabled true, add the following line to the module's ProGuard rules file.

-keep class im.arena.realtimedata.** { *; }

Step 3 : Setup SDK

Initialization links the SDK to the Android context, allowing you to respond to connection and status changes. The RealTimeData.setup() method must be called once across your Android client app. It is recommended to initialize the in the onCreate() method of the Application instance.

RealTimeData
    .environment(Environment.PRODUCTION)
    .logLevel(LogLevel.NONE)
    .configure(CONTEXT)
  • CONTEXT: Base class for maintaining global application state.

The real time data service offers some alternatives for customers to consume data:

REALTIME

Real time data listener

RealTimeData
    .playByPlay
    .realtime(QUERY,
        { success->
        },
        { error->
        })
  • QUERY: Query to request the information provided through the method RealTimeData.playByPlay.query(EVENT_KEY)
  • PER_PAGE: Number of items per page

The return of this call is the ListenerRegistration which can be used later to cancel the real time data stream by calling listenerRegistration.remove()

QUERY

Build the query to retrieve the data.

RealTimeData.playByPlay.query(EVENT_KEY, PRIORITY, ORDER_BY, PER_PAGE, QUERY_INFO)
  • EVENT_KEY: Event identifier
  • PRIORITY: The priority in which elements should be returned: ASCENDING or DESCENDING
  • ORDER_BY: The order in which elements should be returned: NEWEST or OLDEST
  • PER_PAGE: Number of items per page
  • QUERY_INFO: The type of query to be performed. We currently only offer PLAY_BY_PLAY

Returns a Query object containing the information needed to perform a real-time or just a single query

Help

We use GitHub Issues as our bug and feature tracker both for code and for other aspects of the library (documentation, the wiki, etc.).
Labels on issues are managed by contributors, you don't have to worry about them. Here's a list of what they mean:

  • bug: feature that should work, but doesn't
  • enhancement: minor tweak/addition to existing behavior
  • feature: new behavior, bigger than enhancement, it gives more bang
  • question: no need to modify sdk to fix the issue, usually a usage problem
  • duplicate: there's another issue which already covers/tracks this
  • wontfix: working as intended, or won't be fixed due to compatibility or other reasons
  • non-library: issue is not in the core library code, but rather in documentation, samples, build process, releases

License

Arena Android SDK is proprietary software, all rights reserved. See the LICENSE file for more info.

Copyright (c) 2022 Arena Im.

About

Integrate live blog, analytics and real time data services into your Android client applications with speed and efficiency. Our Android SDK helps you focus on the client's implementation of booting, configuring live blog and sending events.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •