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:
Docs | Project | Demo
Room
(see Room
section of app’s build.gradle dependencies section in Initialization and Examples)apply plugin: 'maven-publish'
repositories {
maven {
url "https://venuenext.jfrog.io/venuenext/venuenextsdk-android"
credentials {
username = XXXXXXXXXXXXXXXXX
password = XXXXXXXXXXXXXXXXX
}
}
}
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'
android {
dataBinding {
enabled = true
}
}
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" }
}
}
//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'
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
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>
Navigation.findNavController(view).navigate(com.venuenext.vncoreui.R.id.action_start_to_stands)
Navigation.findNavController(view).navigate(com.venuenext.vncoreui.R.id.walletFragment)
Navigation.findNavController(view).navigate(com.venuenext.vncoreui.R.id.myOrdersFragment)
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>
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!!)
}
VNNavigationController.showMenu(forStandUUID: String?,
forMenuUUID: String?, withStyle: VNNavigationController.DisplayType, usingContext: Context,
usingBaseFragment: Fragment? = null)
VNNavigationController.showOrder(forOrderUUID: String, withStyle: VNNavigationController.DisplayType,
usingContext: Context, usingBaseFragment: Fragment? = null)
VNNavigationController.showMyOrders(withStyle: VNNavigationController.DisplayType, usingContext: Context,
usingBaseFragment: Fragment? = null)
// 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)
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'
To use wallet, you must do the following:
virtualCurrencyName
will be the name that is displayed in wallet and checkout areas of the SDK.showWallet()
will show the VenueNext wallet UI.startLoginFlow()
function.startLoginFlow()
function:
onLoginSuccess(ticketingLoginData: TicketingLoginData)
passes the user’s email address and ticketing provider ID to the SDKonLoginFailure()
- notifies the SDK that the login flow did not complete successfullyVenueNext.walletInterface = myWalletInterface
VenueNext.ticketingInterface = myTicketingInterface
VenueNext.registerDeepLinkable(VnWalletUi)
private fun handleIntent(intent: Intent?) {
if (intent?.action == Intent.ACTION_VIEW) {
intent.data?.let {
if (VenueNext.canHandleDeepLink(it)) {
VenueNext.handleDeepLink(it)
}
}
}
}
Docs | Project | Demo
app_navigation
to core_navigation
(see Initialization and Examples)action_main_to_stands
to action_start_to_stands
(see Initialization and Examples)build.gradle
- com.venuenext.vnlocalytics
(see Initialization and Examples)Docs | Project | Demo