VenueNext Android SDK Integration

The VenueNext SDK provides a simple way to add VenueNext mobile ordering features into 3rd party iOS and Android apps. The SDK is a single package that contains multiple libraries that can be integrated into an Android project.

Features currently available:

Whats New?

v0.2.3 | 10-7-2019

Docs | Project | Demo

Major Changes of Note in v0.2.3

Obtaining the SDK

Configure JFrog Repository

Add plugin and repository to the app’s build.gradle file:

apply plugin: 'maven-publish'
  repositories {
    maven {
      url "https://venuenext.jfrog.io/venuenext/venuenextsdk-android"
        credentials {
          username = XXXXXXXXXXXXXXXXX
          password = XXXXXXXXXXXXXXXXX
        }
    }
}

Required Configuration

Add library dependencies:

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlinx-serialization'
apply plugin: 'androidx.navigation.safeargs'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'

Enable databinding in the app’s build.gradle file:

android {
  dataBinding {
    enabled = true
  }
}

Add dependencies to the project’s build.gradle:

buildscript {
    ext {
        gradle_version = '3.4.2'
        kotlin_version = '1.3.41'
        kotlin_coroutines_version = '1.2.2'
        serialization_version = '0.11.1'
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:$gradle_version"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.7.3"
        classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0"
        classpath 'com.google.gms:google-services:4.3.0'
        classpath 'io.fabric.tools:gradle:1.31.0'
    }
}

allprojects {
  repositories {
    google()
    jcenter()

    maven { url "https://kotlin.bintray.com/kotlinx" }
    }
}

Add dependencies to your app’s build.gradle:

//venuenext
implementation 'com.venuenext:vncore:0.2.3'
implementation 'com.venuenext:vncoreui:0.2.3'
implementation 'com.venuenext:vnanalytics:0.2.3'
implementation 'com.venuenext:vnlocalytics:0.2.3'
implementation 'com.venuenext:vnlegacy:0.2.3'
implementation 'com.venuenext:vnorder:0.2.3'
implementation 'com.venuenext:vnorderui:0.2.3'
implementation 'com.venuenext:vnpayment:0.2.3'
implementation 'com.venuenext:vnticket:0.2.3'
//kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serialization_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"
//ui
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
//lifecycle
implementation "androidx.lifecycle:lifecycle-extensions:2.0.0"
//navigation
implementation "android.arch.navigation:navigation-ui-ktx:1.0.0"
implementation "android.arch.navigation:navigation-fragment:1.0.0"
implementation "android.arch.navigation:navigation-fragment-ktx:1.0.0"
//room
implementation "androidx.room:room-runtime:2.1.0"
kapt "androidx.room:room-compiler:2.1.0"
//firebase
implementation 'com.google.firebase:firebase-core:17.0.1'
implementation 'com.google.firebase:firebase-analytics:17.0.1'
implementation 'com.google.firebase:firebase-messaging:19.0.1'
implementation 'com.google.android.gms:play-services-tagmanager:17.0.0'
//crashlytics
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
//braintree
implementation 'com.braintreepayments.api:braintree:3.0.0'
implementation 'com.braintreepayments.api:drop-in:4.1.0'
//facebook
implementation 'com.facebook.shimmer:shimmer:0.4.0'
//qr codes
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
implementation 'com.google.zxing:core:3.3.3'
//image loading
implementation "com.github.bumptech.glide:glide:4.9.0"
//localytics
implementation 'com.android.support:support-compat:28.0.0'
implementation 'com.google.android.gms:play-services-ads:18.1.1'
implementation "com.google.android.gms:play-services-gcm:17.0.0"
implementation "com.google.android.gms:play-services-location:17.0.0"
implementation 'com.localytics.android:library:5.5+'

implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'com.android.support:multidex:1.0.3'

Initialization and Examples

To initialize the SDK pass in your SDK key and secret. This could potentially go in the onViewCreated handler of a Fragment class. Also, this is where we configure Crash Reporting, Analytics, & Payment Processing for plugging in a specific framework.

GlobalScope.async {
    VenueNext.configureAnalytics(FirebaseAnalytics(this@MainActivity))
    VenueNext.configureAnalytics(LocalyticsAnalytics(this@MainActivity, application!!))

    VenueNextOrders.configurePaymentProcessing(BraintreePaymentProcessableFragment(), true)

    VenueNext.initialize("SDK_KEY", "SECRET_KEY", self.context!!).await()

    withContext(Dispatchers.Main) {
      findNavController().navigate(R.id.action_start_to_stands)
    }
}

Please treat your SDK secret with care. Do not check into source repositories or pass around in the clear

Variations

Add fragment to your MainActivity layout:

<fragment
  android:id="@+id/fragment_main"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  app:navGraph="@navigation/app_navigation"
  android:name="androidx.navigation.fragment.NavHostFragment"
  app:defaultNavHost="true"/>

Add “app_navigation.xml” to your /app/src/main/res/navigation folder

<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            xmlns:tools="http://schemas.android.com/tools"
            android:id="@+id/app_navigation"
            app:startDestination="@id/core_navigation">

    <include app:graph="@navigation/core_navigation"/>

</navigation>

Launching into VenueNext Flows

UI configuration for theme colors

Set the theme in your styles.xml:

<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
  <!-- Customize your theme here. -->
  <item name="colorPrimary">@color/colorPrimary</item>
  <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
  <item name="colorAccent">@color/colorAccent</item>
  <item name="colorButtonNormal">@color/colorAccent</item>
  <item name="colorControlHighlight">@color/colorAccent</item>
</style>

Set resource colors in your colors.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#fff</color>
    <color name="colorPrimaryDark">#000</color>
    <color name="colorAccent">#0075BD</color>
</resources>

Push notification configuration for FCM

override fun onMessageReceived(remoteMessage: RemoteMessage?) {
  super.onMessageReceived(remoteMessage)

  VenueNext.handleRemoteMessage(this, remoteMessage)
}
FirebaseInstanceId.getInstance().instanceId
  .addOnCompleteListener(OnCompleteListener { task ->
    if (!task.isSuccessful) {
      return@OnCompleteListener
    }

    // Get new Instance ID token
    val token = task.result?.token

    // Register device
    VenueNext.registerDevice(this@MainFragment.context!!, token!!)
}

Deeplinking to Menus, Orders, and My Orders

Show Menu

VNNavigationController.showMenu(forStandUUID: String?,
  forMenuUUID: String?, withStyle: VNNavigationController.DisplayType, usingContext: Context,
  usingBaseFragment: Fragment? = null)

Show Orders

VNNavigationController.showOrder(forOrderUUID: String, withStyle: VNNavigationController.DisplayType,
  usingContext: Context, usingBaseFragment: Fragment? = null)

Show My VenueNext Orders

VNNavigationController.showMyOrders(withStyle: VNNavigationController.DisplayType, usingContext: Context,
  usingBaseFragment: Fragment? = null)

Filter Stands Data on Navigation

Based on Product Type

// Use bundle to provide product type filter for stands
val bundle = bundleOf("productType" to ProductType.FOOD.value)
Navigation.findNavController(view).navigate(R.id.action_start_to_stands, bundle)

Wallet Configuration

Wallet Dependencies

If you intend to use the wallet feature of the VenueNext SDK, be sure to include the following dependencies:

implementation 'com.venuenext:vnwallet:0.2.3'
implementation 'com.venuenext:vnwalletui:0.2.3'

Wallet Setup

To use wallet, you must do the following:

If you want push notifications enabled in the VenueSDK please contact us so we can coordinate certificates

API Docs

v0.2.3

Change History

v0.2.2 | 9-27-2019

Docs | Project | Demo

Major Changes of Note in v0.2.2

v0.2.1 | 9-23-2019

Docs | Project | Demo

v0.2.0 | 9-3-2019

Docs | Project | Demo

v0.1.7 | 8-9-2019

Docs | Project | Demo

v0.1.6 | 7-19-2019

Docs | Project | Demo

v0.1.5 | 6-25-2019

Docs | Project | Demo

v0.1.4 | 6-14-2019

Docs | Project | Demo

v0.1.3 | 5-16-2019

Docs | Project | Demo

v0.1.2 | 5-10-2019

Docs | Project | Demo

v0.1.1 | 4-15-2019

Docs | Project | Demo

v0.1.0 | 3-22-2019

Docs | Project | Demo