Android Integration Guide

Integrating Uptick Digital Advertising Widget into Your Android Application

Enhance your Android app by seamlessly integrating our advertising widget. The setup is quick and consists of a few core steps. By following this guide, you can embed the widget and showcase targeted advertising to your audience.

Step 1: Adding Uptick SDK

First, you’ll need to add the Uptick SDK to your project, which provides the necessary tools for integrating our advertising widget into your Android application.

  1. Add the Uptick SDK dependency to your build.gradle (Module: app) file:

    dependencies {
        implementation 'com.uptick:uptick-sdk:1.0.0'
    }
    
  2. Sync your project with Gradle files.

Step 2: Setting Up the Placeholder View

Next, you need to set up a placeholder where the advertising widget will appear. Add a FrameLayout or any other view to your layout XML file.

XML Layout Example:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <FrameLayout
        android:id="@+id/uptickAdView"
        android:layout_width="match_parent"
        android:layout_height="250dp"
        android:background="@android:color/transparent"/>
</LinearLayout>

Step 3: Embedding the Activation Script

After setting up your placeholder, you need to embed the activation script to power the widget and fetch the required content.

Activity Example:

Ensure you have a reference to the FrameLayout in your activity and activate the ad.

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.uptick.sdk.UptickManager

class OrderConfirmationActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_thank_you)

        val uptickAdView: FrameLayout = findViewById(R.id.uptickAdView)

        UptickManager.activateAd(this, uptickAdView, "YOUR_INTEGRATION_ID")
    }
}

Full Example

Here is a complete example of a OrderConfirmationActivity that integrates the Uptick advertising widget.

XML Layout (res/layout/activity_order_confirmation.xml):

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Order Confirmation Page"
        android:textSize="24sp"
        android:layout_gravity="center"/>

    <FrameLayout
        android:id="@+id/uptickAdView"
        android:layout_width="match_parent"
        android:layout_height="250dp"
        android:background="@android:color/transparent"/>

</LinearLayout>

Activity (OrderConfirmationActivity.kt):

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.uptick.sdk.UptickManager

class OrderConfirmationActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_order_confirmation)

        val uptickAdView: FrameLayout = findViewById(R.id.uptickAdView)

        UptickManager.activateAd(this, uptickAdView, "YOUR_INTEGRATION_ID")
    }
}

Troubleshooting Tips

  • Layout Issues: If you encounter any layout disruptions, confirm that you’ve correctly placed the FrameLayout and used the appropriate integration ID.
  • Support: If issues persist, reach out to our technical support team for further assistance.