Rokt Documentation
  • Documentation
  • User Guide
  • SDK
  • API
  • Third-Party Integrations
  • Help

›Integrating the SDK

Getting Started

  • Introduction

Web SDK

  • Overview
  • Architecture
  • Integrating the Web SDK
  • Integration Examples

    • Confirmation Page Integration
    • Preparative Iframe
    • Page Identifier
    • Single Page Applications
    • Brand Conversion Integration
    • In Transaction/Cart Integration
    • Event-based Integration
    • Sandbox Integration
  • Integration Best Practices
  • Attributes
  • Security
  • Mobile In-App Web Pages
  • API

    • README
    • Globals

    Enumerations

    • FailureReason

    Interfaces

    • Attributes
    • Cart
    • CartItem
    • PlacementCloseEvent
    • Rokt
    • RoktConfiguration
    • Widget

iOS SDK

  • Overview
  • Version
  • Integrating the SDK

    • Integrating and Initializing the SDK
    • Launching an Overlay Placement
    • Launching an Embedded Placement
    • Recording a Brand Conversion
    • Sandbox Integration
  • Attributes
  • Security

Android SDK

  • Overview
  • Version
  • Integrating the SDK

    • Integrating and Initializing the SDK
    • Launching an Overlay Placement
    • Launching an Embedded Placement
    • Recording a Brand Conversion
    • Sandbox Integration

    Attributes

    • Core Attributes
    • Vertical Attributes
  • Security

React Native SDK

  • Overview
  • Version
  • Integrating the SDK

    • Integrating and Initializing the SDK
    • Launching an Overlay Placement
    • Launching an Embedded Placement
    • Recording a Brand Conversion
    • Sandbox Integration

    Attributes

    • Core Attributes
    • Vertical Attributes
  • Security
Edit

Integrating and Initializing the SDK

The Rokt SDK for Android Native Applications can be used by Rokt Partners to display overlay or embedded placements or by Rokt Brands to record conversions for their campaigns. The Rokt SDK for Android is deployed using Maven and Gradle. This step by step guide assumes that you are familiar with Gradle and know how to install a plugin for Android development. Note on ProGuard Rules: The Rokt SDK for Android contains ProGuard rules and does not require additional configuration.

All use cases of the SDK will follow the same initial steps to integrate and initialize the SDK in-app. At a high level, these steps are:

  1. Set up a workspace and enable Rokt Gradle repository
  2. Add the Rokt Placement plugin.
  3. Add the Rokt Android SDK module
  4. Initialize the Rokt Android SDK

Following these steps, the execute method of the SDK can then be used in various ways to suit the required use case.

Step 1: Set up a workspace and enable Rokt Gradle repository

To set up a repository follow the instructions from https://docs.gradle.org/current/userguide/declaring_repositories.html

Step 2: Add the Rokt Placement plugin

Add the Rokt Widget plugin repository url in the build.gradle file for the project.

 // file => build.gradle (Project: ....)

allprojects {  
    repositories {      
        google()      
        jcenter()      
        maven {              
            url "https://rokt-eng-us-west-2-mobile-sdk-artefacts.s3.amazonaws.com"      
        } 
    }
}

Step 3: Add the Rokt Android SDK module

Add the Rokt Android SDK module to build.gradle for Module

 // file => build.gradle (Module: ...)

dependencies {
    ...
    // Note: 3.3.4 reflects the latest version of the Rokt Android SDK.
    implementation 'com.rokt:roktsdk:3.3.4'
    ...
}

Step 4: Initialize the Rokt Android SDK

Initialize the Rokt SDK prior to using it in any Activity. The recommended way of calling the init method is inside the Launcher Activity class

Please contact Rokt for the Rokt Tag ID associated with your account. In order to test your integration, you can use the Rokt Tag ID below. Please note that this will need to be replaced by your unique Rokt Tag ID.

Test Integration Tag ID: 222

Kotlin

import com.rokt.roktsdk.Rokt
  
public class LauncherActivity: Activity {
    override fun onCreate(savedInstanceState: Bundle?) {   
        ...
        // The following will reveal a demo integration. To view your integration:
        // 1) Replace the integration test tag ID (222) with your unique Rokt Tag ID 
        // 2) Replace Y.Y.Y with the application version
        Rokt.init("222", "Y.Y.Y", this@LauncherActivity)
        ...
    }
}

Java

import com.rokt.roktsdk.Rokt;
  
public class LauncherActivity extends Activity {
    override fun onCreate(savedInstanceState: Bundle?) {   
        ...
        // The following will reveal a demo integration. To view your integration:
        // 1) Replace the integration test tag ID (222) with your unique Rokt Tag ID 
        // 2) Replace Y.Y.Y with the application version
        Rokt.INSTANCE.init("222", "Y.Y.Y", LauncherActivity.this) 
        ...
    } 
}

The subsequent steps will depend on the use case of the integration. More details can be found here:

  • Launching an Overlay Placement
  • Launching an Embedded Placement
  • Recording a Brand Conversion
← VersionLaunching an Overlay Placement →
  • Step 1: Set up a workspace and enable Rokt Gradle repository
  • Step 2: Add the Rokt Placement plugin
  • Step 3: Add the Rokt Android SDK module
  • Step 4: Initialize the Rokt Android SDK
RESOURCES
DocumentationUser GuideSDKAPIIntegration PartnersHelp
COMPANY
About UsContact UsCareersEngineering Blog
Rokt Documentation
Copyright © Rokt 2021 - All Rights Reserved