Android (Native)

The Appnomix Commerce SDK is a codeless library designed to help brands deepen their relationship with customers by placing the brand prominently on the users' mobile phones.

Minimum requirements

  • Android minSDK version 5.0 (API 21)
  • Android compileSDK version 15 (API 35)

Overview

Follow the instructions below to setup the Appnomix Commerce SDK in your existing Android application.
For any additonal questions regarding the integration, outside the scope of this document, please contact [email protected].

Below is the current list of Android browsers the SDK supports:

  • Google Chrome
    (below is an example of what the SDK will display, on checkout pages, where it has identified available coupons)
Image 1 Image 2 Image 3 Image 4

Integration steps

  1. Add the SDK dependency inside your current Android Gradle project, linking against the latest version:
repositories {
    mavenCentral() // use mavenCentral as the source of this dependency
}

android {
  compileOptions {
    sourceCompatibility = JavaVersion.VERSION_17
    targetCompatibility = JavaVersion.VERSION_17
  
    // backwards support for newer Java APIs the SDK might be using (e.g. SDK using Java_18, while host app using Java_17)
	  isCoreLibraryDesugaringEnabled = true
 }
}

dependencies {
    // other project-specific dependencies above/after this
    implementation("app.appnomix:sdk:1.4.0")
    
    // backwards support for newer Java APIs the SDK might be using
    coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4")
}
  1. Inside your app's main Android Application class, setup the Appnomix SDK by providing the needed data:
import android.app.Application
import app.appnomix.sdk.external.CouponsSdkFacade

class MyApplication : Application() {

    override fun onCreate() {
        super.onCreate()

        CouponsSdkFacade.setup(
            CouponsSdkFacade.Config(
                authToken = "token_received_from_appnomix",
                clientId = "clientId_received_from_appnomix"
            )
        )
    }
}
  1. When presenting the offer to your users (e.g. you have a list of similar offers and Appnomix is one of the providers), you should invoke the following function in order to have an accurate data funnel created.
    The function takes a string parameter and it reflects the context in which this offer was presented. It could be presented when the user sees it from your 'Offers' section (so you could pass "my offers", "special offers", etc) or from other contexts that you see relevant to your app (e.g. "cooldown time", "new level unlocked", etc)
CouponsSdkFacade.trackOfferDisplay("Marble Crush - Next Level")
  1. Trigger the onboarding flow, so that the SDK will instruct the user on what to enable for the SDK to work. For that use the following code snippet:
import app.appnomix.sdk.external.CouponsSdkFacade
import app.appnomix.sdk.external.ExternalCoupon
import app.appnomix.sdk.external.SdkRequirement

class MainActivity : AppCompatActivity() {

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    // you can check for unmet requirements, before launching the onboarding, by requesting them from the SDK and checking if the returned list is empty.
    // val unmetRequirements = CouponsSdkFacade.unmetRequirements()
    
    // calling this will launch the onboarding, only if it wasn't finished before. if it has, it's a no-op 
    CouponsSdkFacade.launchSdkOnboardingActivity(this)
  }
}

  1. (Optional) Should you require more control or if you'd like to further fine-tune the onboarding experience for your users, you can also make use of the following functions the SDK is exposing:
    1. CouponsSdkFacade.isAccessibilityServiceEnabled-> returns true if the service is enabled
    2. CouponsSdkFacade.goToToAccessibilitySettings-> takes the user to the OS Accesibility Settings, directly where the needed permission, without needing to launch the onboarding flow.

You can also see how the above can be integrated with our Appnomix Sample App