Top Banner
Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27 Native SDK for Android Development Guide Version 1.0 Page 1 of 168
168

Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Jul 09, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Native SDK for Android Development Guide

Version 1.0

Page 1 of 168

Page 2: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Table of Contents Table of Contents 2

Introduction 7 Audience 7 Prerequisites 7

Initial Setup 8 Add Swift Swift Shopper Dependency to Your App 8

Open Your App in Android Studio: 8 Update the Project’s “Outer” Build.Gradle File 8 Updated the App Module’s Build.Gradle File 12 Determine or Define the Theme Color 15 Determine or Define an Icon 15 Define a “No Action Bar” Theme 16 Determine or Define the Application Class for Your App 16 Initialize the Swift Shopper SDK When Your App Starts 20

Swift Shopper User Interface Integration 21 Design / Usage Pattern 21 User Login 23

Anonymous Login 23 Implement Anonymous Login 23 Social Media Login 24

Create a Login Activity for Your App 24 Email Login 25 Suggested Strategies 26

Anonymous Login 26 Social Media Login Using SsLoginView 26 Significantly Customized Social Media Login 27 Completely Custom Login 28

Basic Self-Scan Shopping 29 Single Location Support 29 Multiple Location Support 29

Select Market Activity 31 Self-Scan Shopping Activity 34

Navigation Scenario: Single Retail Store Location 37

Page 2 of 168

Page 3: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Test / Verify the Result 38

Navigation Scenario: Multiple Retail Stores 41 Test / Verify the Result 43

Navigation Scenario: Return Home After Checkout 44 Test / Verify the Result 47

Navigation Scenario: User Leaves App While Shopping 47 Test / Verify the Result 49

Navigation Scenario: Exit Store Button + Keep the User Inside the Self-Scan Shopping Activity 50 Cart Widget 55

Cart Widget in Layout XML 55 Cart Widget in Menu XML 56 Illustrated Result 57

Cart Activity 58 Cart Activity - Layout XML 58 Suggestion: Back Button in Action Bar / Toolbar 59 Suggestion: Start the Cart Activity When Cart Widget is Tapped 59

Cart Widget in the Action Bar / Toolbar 59 Cart Widget in Activity’s Layout 60

Order History 62

Shopping Lists 63 Scenario: View/Edit Shopping Lists (Support Only When Not Shopping) 64 Scenario: View/Edit Shopping Lists (Support Only While Shopping) 64 Scenario: View/Edit Shopping Lists (Support When Either Shopping or Not Shopping) 64 Shared Shopping Lists 66

Minimal Behavior Needed From Your App 66 Explanation: lists.swiftshopper.com intent filter 68 Explanation: sslistshare intent filter 70 Explanation: com.swiftshopper.sdk.ShareListAfterLogin intent filter 70 Explanation: Launch Mode Single Task 72 Login Activity - Intent Filters 72

Optimized Behavior Suggested From Your App 73 Sign-up For an Account With “Branch.io” 73 Customize the Text / Email Message from First User to Second User 73 Detect When the Second User Clicks the Shared List Link 75

Viewing Deals 78

User Profile 79

Page 3 of 168

Page 4: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Appendix 1: Class Reference 80 com.swiftshopper.sdk.SwiftShopperSdk 80

Purpose 80 Static Methods 80

initialize 80 scanItemToCart(SsScanResultListener) 82 scanItemToCart(Activity, SsScanResultListener) 83 login(LoginData, LoginListener) 84 login(Activity, LoginData, LoginListener) 85 loginAnonymous(LoginListener) 86 importSharedList(Activity) 87 importSharedList(Intent) 88 importSharedList(int, int) 90 importSharedList(String, String) 91 hasPendingSharedListForImport() 92 logout(LogoutListener) 93 enterStore(int, EnterStoreListener) 94 exitStore(ExitStoreListener) 95 getStore() 96 getUser() 96 toggleScannerGuideBar(boolean) 97

com.swiftshopper.sdk.SsConfig 98 Purpose 98 Methods 98

com.swiftshopper.sdk.SsConfig.Builder 99 Purpose 99 Methods 99

Builder(Context) 99 setActivityTheme(@StyleRes int) 100 setSharedListPath(String) 102 setSharedListIdParam(String) 103 setRetailerSdkKey(String) 104 setThemeColor(@ColorInt int) 105 setSmallLogo(@DrawableRes int) 106 setLargeLogo(@DrawableRes int) 107 build() 107

com.swiftshopper.sdk.SsUser 108

Page 4 of 168

Page 5: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Purpose 108 Methods 108

getUserId() 108 getUserEmail() 108 getUserFirstName() 109 getUserLastName() 109 getUserDisplayName() 110 getUserPhotoUrl() 110 isAnonymous() 111

com.swiftshopper.sdk.SsStoreDetail 112 Purpose 112 Methods 112

getName() 112 getStoreId() 113 getLatitude() 113 getLongitude() 114 hasPosIntegration() 114 isFlyPassEnabled() 115 isFlyThruEnabled() 115 getWelcomeHtml() 116 getRetailerName() 116

com.swiftshopper.sdk.SsScanResult 117 Purpose 117 Methods 117

getMessage() 117 getRawBarcode() 118 getStatusCode() 118

Appendix 2: Intent Actions for Launching Activities 119 Intent Actions 119

ACTION_LOGIN_FOR_PUBLIC_SHARE 119 ACTION_LOGIN_FOR_PRIVATE_SHARE 121 ACTION_LOGIN_TO_VIEW_SHARED_LIST 122 ACTION_CHECKOUT_COMPLETE 124 ACTION_SHARE_LIST_AFTER_LOGIN 125

Appendix 3: Swift Shopper Views 127 Views 127

com.swiftshopper.sdk.ui.view.SsCartView 127

Page 5 of 168

Page 6: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

com.swiftshoper.sdk.ui.view.SsCartButtonView 128 com.swiftshopper.sdk.ui.view.SsOrderHistoryView 129 com.swiftshopper.sdk.ui.view.SsShopOnTheFlyView 130 com.swiftshopper.sdk.ui.view.SsProfileView 131 com.swiftshopper.sdk.ui.view.SsLoginView 132 com.swiftshopper.sdk.ui.view.SsSelectMarketView 134 com.swiftshopper.sdk.ui.view.SsListView 135 com.swiftshopper.sdk.ui.views.SsDealsView 136

Appendix 4: Listener Interfaces 137 SsSelectMarketView.CheckinListener 138

onCheckInComplete 138 SsListView.ShareListDelegate 139

shareList(int, int) 139 SsLoginView.Delegate 142

onLoginSuccess() 142 onLoginFailure(Throwable) 142 proceedAnonymously(Runnable) 143

SsScanResultListener 144 onScanResult(SsScanResult) 144

LoginListener 145 onLoginSuccess() 145 onLoginFailure(Throwable) 145

LogoutListener 146 onLogout() 146

EnterStoreListener 147 onSuccess() 147 onFailure() 147

ExitStoreListener 148 onExitStore() 148

Appendix 5: String Customizations 149 Available Strings for Customization 149

Appendix 6: Troubleshooting 158 App Crashes on Lollipop and Marshmallow at Checkout Screen 158 Emulator Device: SsSelectMarketView’s Loading Animation Spins Forever 160 Emulator Device: Login Does not Work in SsLoginView’s Browser 161

Appendix 7: Play Store Release 162

Page 6 of 168

Page 7: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Appendix 8: License Agreement 164

Introduction The Swift Shopper Native SDK for Android allows portions of the original Swift Shopper Universal App to be incorporated into any Android app that can be developed in Android Studio.

Audience This document is intended for an Android app developer who is currently developing or maintaining an app. This development guide provides comprehensive, step-by-step instructions and illustrations for adding Swift Shopper into any such existing app. This guide tries to err on the side of being perhaps too detailed in order to ensure that any Android developer at any experience level can successfully integrate Swift Shopper with their app.

Prerequisites The following prerequisites are required to integrate the Swift Shopper Native SDK with an Android app:

● Full source code to a working Android app in which to integrate Swift Shopper ● A development computer with Android Studio with sufficient hardware and software

specifications to allow you to build the app in which to integrate Swift Shopper. (If you are a developer who has already been developing and building your app, then these first two prerequisites would certainly be satisfied.)

Page 7 of 168

Page 8: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Initial Setup

Add Swift Swift Shopper Dependency to Your App

Open Your App in Android Studio:

Update the Project’s “Outer” Build.Gradle File

1. Open the project’s “build.gradle” file in Android Studio:

Page 8 of 168

Page 9: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

This is the outer build.gradle file on the file system. This file is prefixed with “Project:”.

Page 9 of 168

Page 10: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

2. Add the Swift Shopper Maven repository to the project’s “build.gradle” file:

Add the following Maven repository definition to the “allprojects” - “repositories” block: maven { url "https://developer.swiftshopper.com/android/releases" }

3. Override the android support library to be the version that your app already uses. Add the following block of code to the bottom of the project’s build.gradle file. Change “28.0.0” to the Android support library version that your app already uses: subprojects {

project.configurations.all {

resolutionStrategy.eachDependency { details ->

if (details.requested.group == 'com.android.support' && !details.requested.name.contains('multidex') ) { details.useVersion "28.0.0" } }

}

} Explanation: The Swift Shopper SDK uses the android support library and had to be linked against a particular version of the Android support library in order to build the Swift Shopper SDK that is hosted for inclusion into your app. At runtime the Swift Shopper SDK will use whatever version the app uses for the support library. The compiler would fail without the configuration specified for this step since the compiler would otherwise try to compile and include the Swift Shopper SDK’s version of the support library and the app’s version of the support library -- this could result into a “dex” error since they are likely to be different versions of the same libraries. Not to worry, the Swift Shopper SDK by design will use whatever support library is compiled into the app.

Page 10 of 168

Page 11: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

4. Illustration of project’s updated “outer” build.gradle file with the Swift Shopper maven

repository setting and the configuration that clarifies which support library to use:

Page 11 of 168

Page 12: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Updated the App Module’s Build.Gradle File 1. Open the app module’s “build.gradle” file in Android Studio.

This is the build.gradle file that is under the app’s directory within the project directory. This file is prefixed with “Module:” as displayed in Android Studio.

2. Add the following dependency for the Swift Shopper SDK: implementation 'com.swiftshopper.sdk:swiftshoppersdk-prerelease:1.0.26'

NOTE: Change 1.0.26 to the latest version for the Swift Shopper SDK as indicated on the https://developer.swiftshopper.com website.

3. Add the following to the “android” definition in the app module’s build.gradle file: compileOptions {

targetCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8 }

dataBinding {

enabled = true }

Page 12 of 168

Page 13: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

4. Illustration of the app module’s build.gradle file with the Swift Shopper dependency and

the compileOptions:

Page 13 of 168

Page 14: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

5. Press “Sync Now”

6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just as your app ran prior to adding the Swift Shopper SDK dependency. At this point, the Swift Shopper SDK is simply compiled into the app although the Swift Shopper SDK is not yet being used within the app. Swift Shopper has tried its best to ensure that these steps are sufficient for including the Swift Shopper SDK as a dependency into any app. Although Swift Shopper believes that there should be no errors compiling your app following these steps, it is possible that Swift Shopper might not have foreseen the exact situation that might be involved with your app. Please attempt to resolve any errors that your app may experience at this point in these instructions. Please feel free to contact [email protected] if you need help. Even if you experience some errors and you are able to resolve them on your own, please reach out to [email protected] and let us know what errors you experienced and how you solved them. Swift Shopper will either update these instructions for future reference, or update the Swift Shopper SDK to avoid any such errors that you may have encountered.

Page 14 of 168

Page 15: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Determine or Define the Theme Color The Swift Shopper SDK draws its user interface using a theme color that you provide. This allows any user interface components that the Swift Shopper SDK draws to match your app’s appearance. Most Android apps define a colorPrimary as a “color” resource.

1. Expand your app’s “res” folder and determine if there is a “values” folder under the “res” folder.

2. See if there is a colors.xml file in the “res/values” folder. If so, open the colors.xml file and see if there is a definition for the colorPrimary value.

3. Add a colors resource file if there is no colors.xml file. 4. Define a value for the app’s primary color if there is no colorPrimary value. The name

does not have to be colorPrimary. The name colorPrimary could affect colors or appearances in the existing app, which may or may not be what you desire. All that matters is that there exists some color definition for the primary color for the app.

Determine or Define an Icon The Swift Shopper SDK presents an icon from your app in certain strategic locations on the various user interface components that the Swift Shopper SDK provides. We suggest that this icon should represent the retail store chain at which your app allows users to shop. This icon probably already exists in the app if your app is an existing app that the retailer has already released to the general public.

1. Open your app’s AndroidManifest.xml file and see if the <application>...</application> element defines an “android:icon”.

2. Take note of the resource that is specified as the “android:icon” if an “android:icon” is defined.

3. Open the corresponding resource in Android Studio and verify that the image looks like an image that truly should represent the retailer or the app.

4. Add a drawable if necessary: any image can be specified for Swift Shopper to use as the icon that Swift Shopper renders in strategic locations on the various user interface components that the Swift Shopper SDK provides.

Page 15 of 168

Page 16: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Define a “No Action Bar” Theme Although the Swift Shopper SDK renders its view components using a specified theme color and icon, the Swift Shopper SDK’s payment screens are rendered via Stripe. Swift Shopper uses Stripe for secure in-app payment. Stripe’s graphical components render themselves according to a specified style resource id. Although Swift Shopper would have preferred to not require you to undertake this particular step, Stripe’s graphical components will only style themselves in accordance with a style resource that is compiled into the app. Please follow these steps to define a style resource that you will then pass into the SwiftShopperSdk.initialize(...) method as described a little later in this document.

1. Edit your app’s “styles.xml” file under the app’s “res/values” folder in the project tree. (Add a “styles.xml” file if you do not

2. Define a style as follows, replace the colors with the appropriate counterparts for your app: <resources> …

<style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="android:navigationBarColor">@color/colorPrimary</item> <item name="android:windowBackground">@android:color/white</item> <item name="titleTextColor">@android:color/white</item> <item name="android:textColorSecondary">@android:color/secondary_text_light</item> <item name="colorControlNormal">@android:color/white</item> <item name="android:fontFamily">@font/kano</item> <item name="android:buttonStyle">@style/AppButton</item> </style> …

</resources>

This style is used to theme some of the payment screens, such as the screen where the user enters or selects a credit card. When testing your app, you may adjust these values to fine-tune the appearance for the payment screens such as the screen where the user enters or selects a credit card.

Determine or Define the Application Class for Your App Determine Whether Your App Already Has an Application Class

Page 16 of 168

Page 17: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

1. Open your app’s AndroidManifest.xml file. 2. Find the <application>...</application> element. 3. See if the <application>...</application> element defines an “android:name” attribute.

If the <application>...</application> element defines an “android:name” attribute then a class with the same name should exist within the “Android” “Project” explorer tree. The following illustration shows an existing app with an Application class already defined:

The following illustration shows an app that does not have an Application class defined:

Create an Application Class if Needed

Page 17 of 168

Page 18: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

1. Right-click the app’s root-most Java package in the “Android” “Project” explorer tree and

choose New => Java Class from the pop-up menu that appears:

2. The Create New Class dialog appears. Enter a name for the application class. It is customary to give this class the TitleCamelCaseName of the application followed by the word Application. Enter “android.app.Application” in the Superclass text box, and press the OK button:

Page 18 of 168

Page 19: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

3. Android Studio creates the class and presents the Java file in a source code editor:

4. Add a stub for the application class’s “onCreate” method that is called when the app is launched within an Android device:

5. Add the “android:name” attribute to the app’s AndroidManifest.xml file’s <application> … </application> element. The value for the “android:name” attribute is a string that consists of the period character followed by the name of the application class that was just created:

Page 19 of 168

Page 20: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Initialize the Swift Shopper SDK When Your App Starts

1. Edit your app’s Application class. 2. Add the following import statements:

import com.swiftshopper.sdk.SsConfig; import com.swiftshopper.sdk.SwiftShopperSdk;

3. Add the following code to the end of the onCreate method. Change the resource identifier that is passed to the setSmallLogo and setLargeLogo method to the corresponding identifier that you previously determined or defined for the app’s icon. Change the resource identifier that is passed to the setThemeColor method to the corresponding identifier that you previously determined or defined for the app’s primary color: SwiftShopperSdk.initialize(new SsConfig.Builder(this) .setRetailerSdkKey("w9mn{dn7lPIF37Yb#>fh)By^Q|AoA3w8<SGXbd2gmPF2|") .setSmallLogo(R.mipmap.ic_launcher) .setLargeLogo(R.mipmap.ic_launcher) .setActivityTheme(R.style.AppTheme_NoActionBar)

.setThemeColor(ResourcesCompat.getColor( getResources(), R.color.colorPrimary, null)) .build());

NOTE: The retailer SDK key associates your app to a retailer within the Swift Shopper infrastructure. Replace the ‘key’ with the ‘key’ that Swift Shopper has assigned to your retailer. If you do not have this key, you may use the key in this example to get you started. Eventually you will need to contact your app’s retailer and ask them to send you their SDK “prerelease” and “production” keys.

4. Build / deploy / run your app again and verify that the app still continues to function normally. Your app now initializes the Swift Shopper SDK when your app is launched, although your app does not yet use any features from the Swift Shopper SDK. This is a sanity check to ensure that the Swift Shopper SDK is not only fully compiled into your app but also capable of starting up.

Page 20 of 168

Page 21: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Swift Shopper User Interface Integration

Design / Usage Pattern The Swift Shopper SDK provides fully implemented graphical user interface components for all of the Swift Shopper features such as self-scan mobile checkout, viewing in-store deals, viewing / editing shopping lists, etc. The general usage pattern is that the Swift Shopper SDK provides a fully implemented custom Android view for each of these Swift Shopper features. All you have to do is create an Activity within your app, add an element to the app’s layout whose name corresponds to the Swift Shopper class name for the view, for example: SsShopOnTheFlyView , SsCartView , SsLoginView , SsDealsView , etc. (See Appendix 3 for a complete listing.) This process will generally be repeated for each Swift Shopper feature that you wish to incorporate into your app. An activities correspond to a screen within your app. All fragments correspond to sections of a screen within your app. After adding a Swift Shopper view to the activity’s or fragment’s layout, you will then provide the means within your app for the user to navigate to these activities or fragments. As long as your app has called SwiftShopperSdk.initialize(...) from your app’s Application class’s onCreate() method when your app starts up, each of these views will then be fully operational. These views will render the user interface colored based on the theme color that your app passes to the SwiftShopperSdk.initialize(...) method, in the font that you have defined for the corresponding activity via the activity’s theme as defined in your AndroidManifest.xml file; likewise for the icon(s) that your app passes to the SwiftShopperSdk.initialize(...) method. In some cases the Swift Shopper views start activities of their own. Those activities are rendered likewise, however the theme used will be either your app’s default theme as defined in your AndroidManifest.xml file or the theme that you pass to SwiftShopperSdk.initialize(...) . Scenarios such as payment activity screens use the theme passed to SwiftShopperSdk.initialize(...) whereas most other scenarios use the themes that you configured directly for you app via the default theme as defined in your AndroidManifest.xml file or the various app-compat themes that you define in your styles.xml file. This is the general pattern for integrating any portion(s) of Swift Shopper within your app. The rest of this document explains each item that is available for integration into your app, along with step-by-step illustrations in some cases for incorporating these items into your app. The same general pattern applies, however, to each item. Step-by-step illustrations are arbitrarily provided

Page 21 of 168

Page 22: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

for various Swift Shopper components so as to give you a general walk-through for integrating Swift Shopper components. For any components for which step-by-step illustrations might not be included, simply review the illustrations for any other component and do likewise.

Page 22 of 168

Page 23: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

User Login Your app needs to log the app’s user into Swift Shopper in order to use the Swift Shopper SDK. There are multiple options for logging the app user into Swift Shopper, each with different benefits.

Anonymous Login Anonymous login is the easiest login to implement. However, anonymous login provides the least amount of benefits to the user. Pros:

● Easiest for the developer to implement ● Does not require any information about the user ● The app developer does not need to maintain their own master database of users

Cons: ● The user will not receive an email receipt when they purchase in the app. ● The user will not be able to share their shopping lists with other users. ● The user will not be able to access any shared shopping lists from other users ● The user’s credit cards will not be saved, except for Google Pay, since Google saves the

user’s payment information outside of the app in the user’s Google Wallet which is connected to the user’s Google account that the user specifies when the user activates their phone or tablet.

Implement Anonymous Login 1. Add the following import statement to your app’s Application class:

import com.swiftshopper.sdk.login.LoginListener;

2. Add the following code to the end of your app’s Application class’ onCreate method: SwiftShopperSdk.loginAnonymous(new LoginListener() { @Override public void onLoginSuccess() { System.out.println("Anonymous login success"); }

@Override public void onLoginFailure(Throwable throwable) { System.out.println("Anonymous login failure: " + throwable); }

});

Page 23 of 168

Page 24: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Social Media Login You may log your users in via any of the following social media account types:

● Google ● Facebook ● Twitter

Pros

● The SwiftShopper SDK provides a fully implemented, easy-to-integrate user interface for social media login.

● The user will receive an email receipt when they purchase in the app. ● The user will be able to share their shopping lists with other users. ● The user will be able to access shared shopping lists from other users ● The user’s credit cards will be saved to their login. ● The user’s purchase history, shared lists, and credit cards will “follow” them if they run

the app on another device provided that they log in via the same social media account on that device.

● The app developer does not need to maintain their own master database of users ● If the app already features a social media login, the app’s own social media login can be

used as the Swift Shopper login too. Cons

● Some users are averse to logging into apps using their social media accounts.

Create a Login Activity for Your App

1. Identify or add an Activity to your app for sign-in 2. Open the Activity’s corresponding layout.xml file or content_layout.xml file and edit as

text. 3. Add a <com.swiftshoper.sdk.ui.SsLoginView/> element to the view hierarchy within the

layout XML file. Be sure to assign an “android:id” so that the view can be accessed from Java code.

4. Define or otherwise resize the view to occupy a substantial amount of the screen’s real estate.

5. Edit the Activity’s java file. Add the following import statements: import com.swiftshopper.sdk.ui.view.SsLoginView;

6. Add the following “implements” declaration to the activity’s java file: implements SsLoginView.Delegate

Page 24 of 168

Page 25: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

7. Add the following methods to the activity class but improvise the functionality. See the

reference in the corresponding Appendix for details: @Override

public void onLoginSuccess() { dismissLoading();

finish();

}

@Override

public void onLoginFailure(Throwable throwable) { Toast.makeText(this, "Login failed:" + throwable, Toast.LENGTH_SHORT).show(); dismissLoading();

}

@Override

public void proceedAnonymously(Runnable runMeToProceed) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getTitle());

builder.setMessage(R.string.login_skip_confirmation_message); // Reverse psychology: "Going Back" or "Cancelling" is illustrated as // the positive choice

builder.setPositiveButton(R.string.login_skip_confirmation_cancel, (d, i)->{ });

builder.setNegativeButton(R.string.login_skip_confirmation_yes, (d,i)->{ showLoading();

runMeToProceed.run(); });

builder.create().show();

}

8. Associate the activity as the login delegate for the SSLoginView that is in the activity’s layout. For example, add code similar to the following code to the activity’s onCreate method that is called when the activity is loaded: SsLoginView ssLoginView = findViewById(R.id.loginView); ssLoginView.setLoginDelegate(this);

Email Login You may log your users into Swift Shopper via the user’s email address. Pros:

● Same benefits as social media login. Cons:

Page 25 of 168

Page 26: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

● The app developer needs to implement the entire user interface flow for collecting the user’s email address, validating the user’s password, etc..

● The app developer needs to maintain a master database of their users, user passwords, etc. Each user’s email address needs to be mapped to a globally unique user id integer that the app develop needs to construct.

Suggested Strategies

Anonymous Login

The pros and cons of anonymous login were previously discussed. If despite the cons (such as no email receipts upon in-store purchase, no shared shopping lists, etc) you wish to provide the most basic integration, simply call SwiftShopperSdk.loginAnonymous(...) perhaps from your app’s Application class’s onCreate method when the app starts. Then your app may allow the user to navigate to any screens that incorporate Swift Shopper features, such as self-scan checkout.

Social Media Login Using SsLoginView

This document explains how to integrate the various Swift Shopper components into your app, such as self-scan mobile checkout, displaying in-store deals, and shopping list support. Your app will inevitably present navigation mechanism (buttons, menus, etc) for the user to invoke in order for your app to navigate the user to perform these tasks. As a user attempts to navigate to any of these tasks, check if the user is logged in yet to Swift Shopper by evaluating the return value after calling SwiftShopperSdk.getUser(). SwiftShopperSdk. getUser() returns a non-null value if the user is logged in. However, the user could be logged in anonymously, so also verify that the isAnonymous() method returns “false”:

import com.swiftshopper.sdk.SsUser; import com.swiftshopper.sdk.SwiftShopperSdk; ...

SsUser ssUser = SwiftShopperSdk.getUser(); if (ssUser!=null && !ssUser.isAnonymous()) { // User is logged in and is not anonymous }

If the user is not yet logged into Swift Shopper or if the user is logged in anonymously, navigate the user to the Login Activity that your app features. This login activity will integrate the SsLoginView into the activity’s layout, as previously described. Make the login activity implement SsLoginView.Delegate and associate the activity as its SsLoginView delegate. From the login activity’s callback that occurs upon successful login, as previously described, start the corresponding activity for the task that the user had tried to perform prior to being directed to login.

Page 26 of 168

Page 27: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Using the SsLoginView , the user may login via their Facebook, Twitter, or Google account. The user may also elect to “skip login” from the SsLoginView in which case, the user is actually logged in anonymously. Of course, if the user attempts to navigate to perform a Swift Shopper task (self-scan mobile checkout, etc.) and if the user is already logged into Swift Shopper, the app should simply allow the user to navigate directly to the chosen task. The SsLoginView allows for some mild customization. From the layout XML file you may specify attribute values that define whether to hide any particular social media login mechanism and/or whether to hide the option to “skip login”. From the layout XML file, you may also specify the “background” or “skipButtonForegroundColor ”. The SsLoginView uses the “skipButtonForegroundColor ” as the color for the “Skip” button’s border and text. If you do not specify the “skipButtonForegroundColor” then SsLoginView will use default coloring (white). If you do not specify the “background”, Android will essentially render the background as transparent thereby using the background from parent elements of the SsLoginView as defined in the layout XML file or the app’s default window background if no backgrounds are defined within the layout XML file. To define the “skipButtonForegroundColor ” and/or whether or not to include certain aspects of the login, add the following namespace declaration to the outermost element within the login activity’s layout XML file: xmlns:app="http://schemas.android.com/apk/res-auto"

Then define any of the following custom attributes on the <com.swiftshopper.sdk.ui.view.SsLoginView> element: app:skipButtonForegroundColor="@color/any_color_that_your_app_defines" app:allowSkipLogin="false" app:allowGoogleLogin="false" app:allowTwitterLogin="false" app:allowFacebookLogin="false" You may also set any of these attributes programmatically via Java code.

Significantly Customized Social Media Login

Alternatively, if you wish to provide a more customized login experience beyond the experience that the SSLoginView provides, you may implement the social media login completely on your own. For example, you may establish a facebook developer account, twitter developer account, and/or google developer account and directly implement social media login in your app. Upon successful social media login from either of these providers, your app receives a corresponding

Page 27 of 168

Page 28: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

social media login token from the corresponding API’s that these social media providers provide. The social media login token is a string of decoded data that represents the logged in user. Once your app receives this token, simply pass this token to the SwiftShopperSdk.

login(...) method within the LoginData parameter. The Swift Shopper SDK will then convert the social media login into a Swift Shopper login and then call the onLoginSuccess() method upon the LoginListener object that you pass to the SwiftShopperSdk.

login(...) method. From that onLoginSuccess () callback, you would then navigate your user to the next activity that your app wishes to display after the user logs in: perhaps an activity that corresponds to a Swift Shopper task that the user may have tried to perform such as self-scan mobile checkout or view in-store deals.

Completely Custom Login

Alternatively, if you wish to provide your own completely customized sign-up process, including having the user establish a user name and password for use in your app, you may implement this on your own too. (There will certainly be back-end / service infrastructure that you will need to either implement or perhaps already have available from the retailer -- perhaps from legacy software or perhaps this may already be implemented in the retailer’s existing mobile apps.) After the user signs in using this mechanism, simply call SwiftShopperSdk.login(...) and pass a globally unique id within the LoginData parameter for the user (to be calculated by your app or back-end infrastructure), along with an email, first name if available, last name if available, profile photo URL if available, etc. Also pass in a LoginListener object. Swift Shopper will convert these values into a Swift Shopper login, the user will be logged into Swift Shopper, and finally the onLoginSuccess() callback will be invoked upon the given LoginListener . From the onLoginSuccess() callback, navigate the user to the activity for the task that the user requested prior to being directed to your custom login activity.

Page 28 of 168

Page 29: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Basic Self-Scan Shopping To add basic in-store shopping, your app should provide one or two activities for self-scan shopping, depending on whether the app is written for a retailer with one versus multiple locations: Select Market Activity (for supporting multiple locations) and In-Store Shopping Activity (for the actual shopping experience). Your app should provide a navigation means to allow the user to initiate in-store shopping. This may be a button on another Activity in your app, a menu option on another Activity’s toolbar, app menu, etc.

Single Location Support When the user elects to navigate to the “In-Store Shopping” Activity, the app needs to call the SwiftShopperSdk.enterStore(int, ExitStoreListener) method, and then start the “In-Store Shopping” activity from the given onSuccess() method of the ExitStoreListener object that is passed into the SwiftShopperSdk.enterStore(int, ExitStoreListener) method. The following example explicitly enters a retail store. This example assumes that:

● The Swift Shopper retailer store identifier is 50 for the particular store. You will need to ask the retailer for whom you are incorporating Swift Shopper into their app for their Swift Shopper retailer store identifier. Once again, this scenario would only apply if the retailer has exactly one physical brick-and-mortar store.

● The source code is within the Java file for a hypothetical activity whose class name is MainActivity.

● The app has an activity class named InStoreShoppingActivity that incorporates the SsShopOnTheFly view within the activity’s layout.

SwiftShopperSdk.enterStore(50, new SwiftShopperSdk.EnterStoreListener() { public void onSuccess() { startActivity(new Intent(MainActivity.this, InStoreShoppingActivity.class)); }

public void onFailure() { }

});

Multiple Location Support When the user chooses to shop, your app needs to start either the app’s Select Market Activity or the app’s In-Store Shopping Activity. When the user taps the button, menu item, etc. that your app provides to initiate the in-store shopping experience, if the app is currently checked into a store, your app should start your app’s shopping activity. You app may call the

Page 29 of 168

Page 30: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

SwiftShopperSdk.getStore() method to determine if the app is checked into a store. The SwiftShoperSdk.getStore() method returns a non-null SsStoreDetail object if the user is currently checked into a store:

if (SwiftShopperSdk.getStore() == null) { // The app needs to check into a store...perhaps start your Select Market activity } else { // The app is already checked into a store...perhaps start your In-Store Shopping // activity

}

If your app is not currently checked into a store, your app should navigate the user to your app’s Select Market Activity, which has an SsSelectMarketView within the activity’s layout. The SsSelectMarketView utilizes the Swift Shopper SDK to prompt the user to choose a nearby store. Your app will then receive a callback when the user chooses a nearby store. From the callback your app should start the app’s shopping activity. You may also program your app to display the information about the current store if you wish. The information is available via the various methods that are on the SsStoreDetail object that your app may attain by calling the SwiftShopperSdk.getStore() method.

Page 30 of 168

Page 31: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Select Market Activity To help support the scenario where the app is for a retailer that has multiple physical brick-and-mortar locations, the Swift Shopper SDK provides a ‘Select Market’ view that you can place on an activity or fragment for your app. This section may be skipped if the app only needs to support a single physical location. Simply create an activity. Perhaps name the activity as SelectMarketActivity. Add a <com.swiftshopper.sdk.ui.view.SsSelectMarketView/> element to your activity’s layout XML file. Size the SsSelectMarketView element to provide a decent amount of real estate from the screen, perhaps even size the SsSelectMarketView element to fill the entire screen minus any real-estate that your app uses for providing menus, navigation, etc. The following steps will guide you to create a Select Market Activity, add an SsSelectMarketView to the activity, listen from the Select Market Activity for the user to select a store to shop at, and start your app’s In-Store / Self-Checkout Shopping Activity immediately after the user chooses a brick-and-mortar store at which to shop:

1. Create a New Android Activity, perhaps using Android Studio’s “File -> New -> Activity -> Basic Activity” wizard. Name the activity as SelectMarketActivity.

2. Open the Activity’s layout XML file and edit as text

Page 31 of 168

Page 32: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

3. Add the following XML element perhaps to the outermost layout element which defines a

Swift Shopper SsSelectMarketView that occupies the entire screen: <com.swiftshopper.sdk.ui.view.SsSelectMarketView android:id="@+id/select_market" android:layout_width="match_parent" android:layout_height="match_parent"/>

4. The resulting layout XML file might look something like this: <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout 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:layout_width="match_parent"

android:layout_height="match_parent"

app:layout_behavior="@string/appbar_scrolling_view_behavior"

tools:context="com.retailer.anyapp.swiftshopper.SelectMarketActivity"

tools:showIn="@layout/activity_select_market">

<com.swiftshopper.sdk.ui.view.SsSelectMarketView android:id="@+id/select_market" android:layout_width="match_parent" android:layout_height="match_parent"/>

</android.support.constraint.ConstraintLayout>

5. Open the Java file for the Select Market Activity 6. Add the following import statement:

import com.swiftshopper.sdk.ui.view.SsSelectMarketView;

7. Locate or create the overridden onCreate method. 8. Add the following code to the onCreate method to start your app’s in-store / self-scan

shopping activity immediately after the user selects a nearby retail store to shop at: SsSelectMarketView ssSelectMarketView = findViewById(R.id.select_market); ssSelectMarketView.setCheckInListener(()->{

finish();

startActivity(new Intent(SelectMarketActivity.this, SelfScanShoppingActivity.class));

});

This sample code assumes that the app’s In-Store / Self-Scan Shopping activity is named SelfScanShoppingAcivity. See the next section within this document for details about creating the In-Store /

Page 32 of 168

Page 33: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Self-Scan Shopping activity. This sample code also assumes that you assigned an id of “select_market” to the SsSelectMarketView when you declared the SsSelectMarketView in the activity’s layout XML file. Feel free to choose a different id instead of “select_market” if you would prefer. Note that this code sample calls finish() on the activity prior to starting the app’s SelfCheckoutActivity. This causes the user to be brought to the original activity that started the SelectMarketActivity in the event that the user navigates back from the SelfCheckoutActivity. Otherwise the user would be brought back to the SelectMarketActivity if the user were to navigate back away from the SelfCheckoutActivity. In this particular scenario, the user would probably be annoyed if the app were to bring the user back to the SelectMarketActivity.

9. Start your app’s SelectMarketActivity from the opportune location, perhaps in response to the user pressing a button that you will add perhaps on your app’s main outer activity or perhaps from a toolbar or menu item on the app’s main outer activity.

Page 33 of 168

Page 34: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Self-Scan Shopping Activity The Swift Shopper SDK provides a view for self-scan shopping that you can place on one of your app’s Activities (or on a new Activity within you app). This self-contained view provides the basic in-store self-scan shopping experience. This view displays the contents of the user’s shopping cart, a ‘scan’ button, and a ‘checkout’ button, plus the other relevant screens that appear after the ‘scan’ and ‘checkout’ buttons are tapped. In order to use this view, the app must first be checked into a particular retailer store location. As previously described, there are two options to implement checking into a retail store location:

1. Call the SwiftShopperSdk.enterStore(...) method from code within the app. This mechanism is intended to support the scenario where an app supports shopping at exactly and only one physical store location.

2. Implement the Select Market functionality as described previously in this document. When the user chooses to shop, program the app to visit the app’s In-Store shopping activity if the app is already checked into a store. Otherwise, program the app to first visit the app’s Select Market activity if the app is not checked into a store. The Swift Shopper Select Market view walks the user through checking into a nearby store, and makes a callback to the specified listener object after the user selects a store. From that callback, program the app to then start the app’s In-Store / Self-Scan Shopping activity. Your app’s code may call the SwiftShopperSdk.getStore() method to determine whether the app is checked into a store. This function returns a non-null SsStoreDetail object if your app is checked into a store.

Simply create an Android activity within your app. Perhaps name the activity as InStoreShoppingActivity or SelfScanShoppingActivity. Edit the activity’s layout XML file and add a <com.swiftshopper.sdk.ui.view.SsShopOnTheFlyView/> element to the activity’s layout XML

Page 34 of 168

Page 35: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Step-by-step instructions for creating the “In-Store Shopping” activity are as follows:

1. Create a New Android Activity, perhaps using Android Studio’s “File -> New -> Activity -> Basic Activity” wizard. Name the activity as InStoreShoppingActivity or SelfScanShoppingActivity:

2. Open the Activity’s layout XML file and edit as text 3. Add the following XML element perhaps to the outermost layout element which defines a

Swift Shopper SsShopOnTheFlyView that occupies the entire screen: <com.swiftshopper.sdk.ui.view.SsShopOnTheFlyView android:id="@+id/select_market" android:layout_width="match_parent" android:layout_height="match_parent"/>

4. The resulting layout XML file might look something like this: <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout 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:layout_width="match_parent"

android:layout_height="match_parent"

app:layout_behavior="@string/appbar_scrolling_view_behavior"

Page 35 of 168

Page 36: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

tools:context="com.retailer.anyapp.swiftshopper.SelfScanShoppingActivity"

tools:showIn="@layout/activity_self_scan_shopping"> <com.swiftshopper.sdk.ui.view.SsShopOnTheFlyView android:layout_width="match_parent" android:layout_height="match_parent"/> </android.support.constraint.ConstraintLayout>

The general idea is simply to create an activity or identify an existing activity that will feature the self-scan shopping user interface. Edit the activity’s layout XML file. Add an SsShopOnTheFly view to the activity’s layout. Then next section discusses adding the mechanism to navigate from your app’s main or home screen to the In Store Shopping scene.

Page 36 of 168

Page 37: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Navigation Scenario: Single Retail Store Location This section describes how to setup and program your app’s user interface to allow the user to navigate to the In-Store Shopping scene assuming that your app only needs to support shopping at a single retail store location. You may skip to the section Navigation Mechanism for Supporting Multiple Retail Store Locations if your app needs to support allowing the user to shop at closest available retail store location. Determine and implement the user interface mechanism that you’d like to provide within your app that the user will invoke to start self-scan shopping at your retailer’s one-and-only brick-and-mortar store. For example, this could be a button on your main activity or a menu-item on your main activity’s toolbar. Add a progress bar to the user interface too. Assuming that you decided to update your main activity whose name is MainActivity with a button whose layout id is “self_scan_shopping_button ” and with a progress bar whose id is “my_progress_bar ”, and assuming that your in-store / self-scan shopping activity’s class name is SelfScanShoppingActivity, add the following code to the main activity’s onCreate method: findViewById(R.id.self_scan_shopping_button).setOnClickListener((v)->{ ProgressBar progressBar = findViewById(R.id.my_progress_bar); progressBar.setVisibility(View.VISIBLE); SwiftShopperSdk.enterStore(50, new SwiftShopperSdk.EnterStoreListener() { @Override public void onSuccess() { progressBar.setVisibility(View.INVISIBLE); startActivity(new Intent(MainActivity.this, SelfScanShoppingActivity.class)); } @Override public void onFailure() { Toast.makeText(MainActivity.this, "Error checking into the store.", Toast.LENGTH_SHORT).show(); progressBar.setVisibility(View.INVISIBLE); } }); });

Page 37 of 168

Page 38: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Test / Verify the Result To test, run your app either on a real android device or from an Android emulator within Android Studio. For example, a simple app with a Main Activity and a “shop” button both on the main activity and in the action bar / toolbar looks as illustrated on the left of this paragraph. Tap the shop button. Behind-the-scenes, the app’s onClick listener and/or onOptionsItemSelected callback displays an Android progress bar and invokes the SwiftShopperSdk.enterStore(...) method passing in an integer that identifies the particular store to enter, and passing in a listener object. The Swift Shopper SDK asynchronously checks the app into the specified store. The listener objects’s onSuccess callback is then invoked

moments later. The logic in the onSuccess callback hides the Android progress bar and starts the app’s SelfScanShoppingActivity. The Self Scan Shopping Activity appears displaying the SsShopOnTheFlyView . The SsShopOnTheFlyView displays the contents of the user’s shopping and a “Scan” button. The shopping cart is initially empty. Tapping the scan button will reveal the “Scan To Cart Item” activity that is automatically rendered by and completely defined within the Swift Shopper SDK. The user will first be prompted to permit the app to access the camera if the app has not yet been granted permission to access the camera.

Page 38 of 168

Page 39: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Point your camera at the following barcode once the “Scan to Cart Item” dialog appears if you are testing on an actual, physical Android device:

Simply wait 2 or 3 seconds if the app is running in an Android emulated device. Android emulated devices feature a simulated video stream which makes it impossible to point a camera at a barcode. The Swift Shopper SDK detects whether the app is executing within an emulated Android device and automatically pretends like the above barcode is scanned after a two or three second delay. After scanning a barcode the app automatically returns to the activity that has the SsShopOnTheFly view. The scanned grocery store product now appears in the shopping cart. The “checkout” button is now enabled upon the SsShopOnTheFly view. Tap the “checkout” button to proceed to the next screen where the shopper chooses how to check out, enters payment details, etc.

Page 39 of 168

Page 40: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

The “Please Choose” activity provided by the Swift Shopper SDK allows the shopper to choose whether to pay in the store at a checkout counter or whether to pay in the app. To quickly test an in-app payment, expand the “Mobile Payment” drop down and select “Credit / Debit”. Then enter the following test credit card on the “Add Card” screen that appears:

Card Number: 4242 4242 4242 4242 Expiration Date: Any date in the future. CVC: Any three digits

Press the “Continue” button after entering the test credit card number. The app returns to the “Please Choose” screen and the VISA test card appears as the “Mobile Payment”. Then press the “Make Payment” button to pay.

An activity then appears prompting the shopper to present their receipt to the attendant at the exit door. An activity displaying the receipt then appears after the shopper presses the “Show

Receipt” button. The shopper shows the on-screen receipt to the attendant at the exit door and then long presses the “RECEIPT VALIDATED” button to conclude the shopping experience.

Page 40 of 168

Page 41: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Unless you have already skipped ahead in this document and implemented the “Return Home After Shopping” functionality, you may notice that nothing happens after the long-press and hold operation is complete. Your app will need to listen for a corresponding Android intent / action broadcast when the user finishes shopping. Your app will then call the Android startActivity method to return the user to the pertinent activity in the app that is outside of the shopping experience. Most apps opt to bring the user to the app’s main activity after the user concludes their shopping session.

Navigation Scenario: Multiple Retail Stores To support shopping at multiple retail stores, the idea is that when the user chooses to ‘Shop’ from within your app, your app will first navigate the user to the app’s “Select Market” activity, which you will create and whose layout will include the SsSelectMarketView within the activity’s layout. The Swift Shopper SDK will present the user with a list of nearby stores prompting the user to select a store. After the user selects a store, the Swift Shopper SDK then calls a callback function in your app. The code in your app’s callback method will then subsequently navigate the user to the In-Store / Self-Scan Shopping activity. The In-Store / Self-Scan Shopping activity is an activity that you will add to your app, whose layout includes an SsShopOnTheFly view. The SsShopOnTheFlyView should fill most or all of the screen real-estate. The SsShopOnTheFlyView allows the user / shopper to do self-scan shopping at the current store in which the app has most recently “entered”. The app enters a store by either (a) the app’s logic explicitly calls the SwiftShopperSdk.enterStore(...) method specifying the Swift Shopper unique identifier for the particular store or (b) the app has presented the user with an activity that includes the SsSelectMarketView in the activity’s layout, the user has selected a nearby market, and your app presumably provides a callback which then navigates to the app’s In-Store / Self-Scan Shopping activity containing the SsShopOnTheFlyView . The following steps make the following assumptions:

● You decided to update your main activity whose name is MainActivity with a button whose layout id is “self_scan_shopping_button ”

● Your Main Activity’s layout also has a progress bar whose id is “my_progress_bar ” ● Your app has an activity class named SelectMarketActivity whose layout contains an

SsSelectMarketView as described earlier in this document ● Your app has an in-store / self-scan shopping activity class named

SelfScanShoppingActivity whose layout contains an SsShopOnTheFlyView as described earlier in this document.

Page 41 of 168

Page 42: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Add the following code to the onClick listener for the button, to the onOptionsItemSelected(...) method if the shop button is on the action bar / toolbar, or to whatever callback mechanism you have chosen to implement in your app that executes when the user chooses to begin in-store / self-scan shopping from your app:

startActivity(this, SelectMarketActivity.class);

For example, to start the Select Market Activity in response to a button whose id is “self_scan_shopping_button”: findViewById(R.id.self_scan_shopping_button).setOnClickListener((v)->{ startActivity(this, SelectMarketActivity.class); }); Make sure that your SelectMarketActivity registers the Check In Listener as described earlier in this document. The check-in listener is called when the user selects a nearby store to shop at. Make the SelectMarketActivity (a) call finish() and (b) start your app’s in-store / self-scan shopping activity from the check in listener’s callback. For example, from the SelectMarketActivity’s onCreate method, assuming that the SelectMarketActivity’s SsSelectMarketView ’s android id is declared as select_market in the corresponding layout XML file: public class SelectMarketActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_select_market); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); SsSelectMarketView ssSelectMarketView = findViewById(R.id.select_market); ssSelectMarketView.setCheckInListener(()->{ finish(); startActivity(new Intent(SelectMarketActivity.this, SelfScanShoppingActivity.class)); }); } … }

Page 42 of 168

Page 43: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Test / Verify the Result To test, run your app either on a real android device or from an Android emulator within Android Studio. For example, a simple app with a Main Activity and a “shop” button both on the main activity and in the action bar / toolbar looks as illustrated on the left of this paragraph. Tap the shop button. The app’s onClick handler for the shop button starts the app’s Select Market Activity. The Select Market Activity starts and its SsSelectMarketView attempts to access the device’s location to look for nearby stores. The SsSelectMarketView causes the device to request location permission if the user has not yet granted location permission for the app. The Select Market Activity’s SsSelectMarketView then displays a list of nearby stores for the user to choose from.

The user selects a store from the list. A dialog appears with the store’s welcome message that the store’s manager has preconfigured into the Swift Shopper cloud. The user has to check the “I Accept Terms & Conditions” checkbox and then the user presses the “Enter” button. The check-in listener that the Select Market Activity specified receives a callback as the user selects a store.

Page 43 of 168

Page 44: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

The logic in the check-in listener then starts the app’s In-Store / Self-Scan Shopping Activity. The rest of the testing and verification is the same as the testing and verification steps from the latter half in the previous scenario (Navigation Scenario: Single Retail Store Location) after the testing steps for the In-Store / Self-Scan Shopping Activity as described in that section.

Navigation Scenario: Return Home After Checkout In the example scenarios that have been described so far, the app is stuck at the final screen that is displayed during the checkout process. That is because the app still needs to do one final thing! The app needs to listen for the checkout event and then the app needs to automatically navigate the user back to the app’s home screen after the user completes their in-app / self-scan checkout in the app. The Swift Shopper SDK broadcasts an Android action intent when checkout is completed. (Action intents are essentially events that logic within an app can listen for in order to execute some specified logic when the action intent broadcast occurs). Android action intents are identified by their action name string. The checkout-complete intent action’s name is available via the constant SwiftShopperSdk.ACTION_CHECKOUT_COMPLETE as defined in Appendix 2. Register an Android broadcast receiver from your application class’s onCreate method to listen for the ACTION_CHECKOUT_COMPLETE action intent. Have the receiver start the app’s main / home activity. Your application class’s onCreate method is the same method in which this document previously instructed you to call SwiftShopperSdk. initialize(...) . Procedure

1. Add an instance variable to your application class named mSwiftShopperBroadcastReceiver whose type is android.content.BroadcastReceiver. The application class will need to import the android.content.BroadcastReceiver class. import android.content.BroadcastReceiver; …

public class MyApplication extends Application {

Page 44 of 168

Page 45: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

public BroadcastReceiver mSwiftShopperBroadCastReceiver = … }

2. Set the variable equal to an inline anonymous class instance that derives from the Android BroadcastReceiver class and overrides / defines the onReceive(...) method. public BroadcastReceiver mSwiftShopperBroadCastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { ...

}

};

3. Add logic to the onReceive method that asks Android to start the app’s main / home activity while simultaneously clearing the navigation back stack. (Clearing the navigation back stack makes it so that the user cannot navigate back into the shopping experience. Swift Shopper broadcasts the checkout-complete intent action immediate after the user’s shopping experience has concluded. The user would / should have to click the app’s shop button, or whatever user interface mechanism your app provides to initiate shopping if the user wishes to go shopping again.) import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; …

public class MyApplication extends Application { …

public BroadcastReceiver mSwiftShopperBroadCastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Intent mainActivityIntent = new Intent(getApplicationContext(), MainActivity. class); mainActivityIntent.addFlags(Intent. FLAG_ACTIVITY_NEW_TASK | Intent. FLAG_ACTIVITY_CLEAR_TASK); startActivity(mainActivityIntent);

}

};

} This example defines a broadcast receiver that calls Android’s startActivity(...) method when the action / event occurs. This receiver passes an Android intent to the startActivity(...) method that asks Android to start the app’s main / home activity. The intent for starting the app’s main / home activity includes the FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_CLEAR_TASK flags which asks Android to

Page 45 of 168

Page 46: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

also clear the navigation back stack as the home / main activity is started. In the next step you’ll register this broadcast receiver so that Android will invoke the receiver’s onReceive method when the Swift Shopper ACTION_CHECKOUT_COMPLETE intent action is broadcast, which happens immediately after the user long presses and holds the final button on the last screen after completing their checkout during in-app / self-scan shopping.

4. Make the app’s application class ask Android to execute the receiver’s onReceive method when the Swift Shopper ACTION_CHECKOUT_COMPLETE intent action / event occurs: import android.content.IntentFilter; ...

public class MyApplication extends Application { ...

public BroadcastReceiver mSwiftShopperBroadCastReceiver = ... ...

@Override public void onCreate() { super.onCreate(); ...

IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(SwiftShopperSdk.ACTION_CHECKOUT_COMPLETE); registerReceiver(mSwiftShopperBroadCastReceiver, intentFilter); }

...

}

5. The app’s application class needs to explicitly tell Android to stop listening for the ACTION_CHECKOUT_COMPLETE intent action / event whenever the app itself is stopped. To do this, simply make the app’s application class override the onTerminate method and call the Android unregisterReceiver method as follows:

Page 46 of 168

Page 47: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

...

public class MyApplication extends Application { ...

public BroadcastReceiver mSwiftShopperBroadCastReceiver = ... ...

@Override public void onTerminate() { unregisterReceiver(mSwiftShopperBroadCastReceiver);

super.onTerminate(); }

...

}

Test / Verify the Result You may now run your app again, go shopping, scan a barcode, checkout, and when complete your app will navigate the user to the app’s main / home screen.

Navigation Scenario: User Leaves App While Shopping In case the user leaves the app while in the middle of shopping and then subsequently returns to the app it is suggested that your app’s Application class check whether the user is currently checked into a store for shopping when the app launches. Automatically navigate the user to the self-scan shopping scene if the user is currently checked into a store when the app launches.

Page 47 of 168

Page 48: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Otherwise the user would have to (awkwardly?) re-enter the store in order to continue shopping and the user might not understand that they would need to undergo these (awkward?) steps. Steps

1. From the app’s application class’s onCreate method, check if there app is currently checked into a store for in-app / self-scan shopping. public class MyApplication extends Application { ...

public void onCreate() { super.onCreate(); ...

SwiftShopperSdk.initialize(...); ...

if (SwiftShopperSdk.getStore() == null) { // The app is not checked into a store for self-scan shopping

...

} else { // The app is checked into a store for self-scan shopping

...

}

...

}

...

}

2. Ask Android to start the in-app / self-scan shopping activity if the app is currently

checked into a store for in-app / self-scan shopping. public class MyApplication extends Application { ...

public void onCreate() { super.onCreate(); ...

SwiftShopperSdk.initialize(...); ...

Intent startingActivity;

if (SwiftShopperSdk.getStore() == null) { // The app is not checked into a store for self-scan shopping

...

} else { // The app is checked into a store for self-scan shopping

startingActivity = new Intent(getApplicationContext(), SelfScanShoppingActivity.class);

}

startingActivity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(startingActivity);

Page 48 of 168

Page 49: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

}

...

} NOTE: The FLAG_ACTIVITY_NEW_TASK flag is required effective with the Android Pie version of Android whenever calling the Android startActivity method from a class that is not a subclass of the Android Activity class.

3. Otherwise ask Android to start the app’s main / home activity if the app is not currently checked into a store for in-app / self-scan shopping. public class MyApplication extends Application { ...

public void onCreate() { super.onCreate(); ...

SwiftShopperSdk.initialize(...); ...

Intent startingActivity;

if (SwiftShopperSdk.getStore() == null) { // The app is not checked into a store for self-scan shopping

startingActivity = new Intent(getApplicationContext(), MainActivity.class); } else { // The app is checked into a store for self-scan shopping

startingActivity = new Intent(getApplicationContext(), SelfScanShoppingActivity.class);

}

startingActivity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(startingActivity);

}

...

}

Test / Verify the Result Run the app, tap the shop button, choose a store, and enter the store. After the app’s in-app / self-scan shopping activity appears, bring up the Android task manager and swipe away or otherwise force-close the app. Then re-launch the app and verify that the app’s in-app / self-scan shopping activity appears instead of the main / home activity. After the app relaunches at the in-app / self-scan activity, scan the test barcode, and complete the checkout. After the app’s main / home activity appears, bring up the Android task manager and swipe away or otherwise force-close the app. Then re-launch the app and verify that the app’s main / home activity is the initial activity that appears.

Page 49 of 168

Page 50: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Navigation Scenario: Exit Store Button + Keep the User Inside the Self-Scan Shopping Activity It is suggested that you consider keeping the user inside of the app’s in-app / self-scan shopping activity, or any subsequent activity that the user visits from the in-app / self-scan shopping activity (if viewing in-store deals as described later in this document, if shopping from their shopping list as described later in this document, etc). To navigate “back” from an activity, the user will either (scenario a) click the back button from the Android system-ui navigation bar that is located at the bottom of the screen or (scenario b) click the back button from the app’s action bar / toolbar located at the top of the screen if the app provides a standard action bar / toolbar for navigation. Steps

1. Activate the back button on your app’s in-app / self-scan activity action bar / toolbar. To do this, call the following methods from your app’s in-app / self- scan shopping activity’s onCreate method:

getSupportActionBar().setDisplayHomeAsUpEnabled(true);

2. Change the back button’s icon to a close icon on your app’s in-app / self-scan activity action bar / toolbar. To do this, call the following method from your app’s in-app / self-scan shopping activity’s onCreate method:

getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_close); NOTE: Your app’s auto-generated R.drawable class inherits the close icon from the Swift Shopper SDK’s R.drawable class. The Swift Shopper SDK’s close icon is a white “X”. You may add your own drawable resource instead if the white “X”icon is not suitable for your app’s user interface.

3. Override your in-app / self-scan shopping activity’s onSupportNavigationUp method and call the onBackPressed method.

Page 50 of 168

Page 51: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

public class SelfScanShoppingActivity extends AppCompatActivity { …

@Override public boolean onSupportNavigateUp() { onBackPressed();

return true; }

} NOTE: Assuming that your app’s in-app / self-scan shopping extends from Android’s AppCompatActivity, the onSupportNavigationUp method is called when the up / back button is pressed from the activity’s action bar / toolbar.

4. Override your app’s in-app / self-scan shopping activity’s onBackPressed method. public class SelfScanShoppingActivity extends AppCompatActivity { …

@Override public void onBackPressed() { ...

}

}

NOTE: The activity’s onBackPressed method is called when the user taps the back button from the Android system navigation bar that is located at the bottom of the screen. NOTE: The previous step instructs you to have the onBackPressed method also be called when the user taps the back button from the in-app / self-scan activity’s action bar / toolbar.

Page 51 of 168

Page 52: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

5. Construct and show an Android alert dialog from the onBackPressed method:

import android.support.v7.app.AlertDialog; ...

public class SelfScanShoppingActivity extends AppCompatActivity { ...

@Override public void onBackPressed() { AlertDialog.Builder builder = new AlertDialog.Builder(this); ...

builder.create().show();

}

...

}

6. Set the title for the alert dialog:

@Override public void onBackPressed() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getTitle()); builder.create().show();

}

7. Set the message for the alert dialog: @Override public void onBackPressed() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getTitle());

builder.setMessage(R.string.exit_store_confirm); builder.create().show();

}

NOTE: You should never hard-code a user-interface String. As such, the example illustrates setting the message to R.string.exit_store_confirm. Define the exit_store_confirm message in your app’s strings.xml resource file: <resources> … <string name="exit_store_confirm">Are you sure you want to exit the store? Any items in your cart will be cleared!</string> … </resources>

Page 52 of 168

Page 53: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

8. Set the “Yes” and “No” buttons for the alert dialog:

@Override public void onBackPressed() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getTitle());

builder.setMessage(R.string.exit_store_confirm);

// Reverse psychology: "Going Back" or "Cancelling" is rendered // as the positive choice

builder.setPositiveButton(R.string.exit_store_confirm_no, (d, i)->{ });

builder.setNegativeButton(R.string.exit_store_confirm_yes, (d,i)->{ ...

});

builder.create().show();

}

NOTE: You should never hard-code a user-interface String. As such, the example illustrates setting the “Yes” button’s text to R.string.exit_store_confirm_yes and the “No” button’s text to R.string.

Exit_store_confirm_no. Define these strings in your app’s strings.xml resource file: <resources> … <string name="exit_store_confirm">Are you sure you want to exit the store? Any items in your cart will be cleared!</string> <string name="exit_store_confirm_yes">Yes</string> <string name="exit_store_confirm_no">No</string> … </resources>

9. Define the logic that exits the store then simultaneously starts the app’s main / home activity while clearing the navigation stack when the user taps the “Yes” button: @Override public void onBackPressed() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getTitle());

builder.setMessage(R.string.exit_store_confirm);

// Reverse psychology: "Going Back" or "Cancelling" is rendered // as the positive choice

builder.setPositiveButton(R.string.exit_store_confirm_no, (d, i)->{ });

builder.setNegativeButton(R.string.exit_store_confirm_yes, (d,i)->{ SwiftShopperSdk.exitStore(()->{ startActivity(

new Intent(SelfScanShoppingActivity.this, MainActivity.class).addFlags( Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK)); });

});

builder.create().show(); }

Page 53 of 168

Page 54: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

NOTE: This sample logic calls SwiftShopperSdk.exitStore(...) and passes in a Java lambda. The SwiftShopperSdk.exitStore(...) method asynchronously checks the app out of the current store and then calls the listener’s logic after the app is checked out from the current store. The sample logic in the Java lambda asks Android to start the app’s MainActivity class using flags FLAG_ACTIVITY_CLEAR_TASK and FLAG_ACTIVITY_NEW_TASK. This clears the app’s navigation stack so that the user will not be able to navigate back into the shopping activity. NOTE: There is no logic defined for the “No” button. This is intended for good reason. Nothing should happen other than Android automatically closing the dialog box if the user presses the “No” button.

Page 54 of 168

Page 55: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Cart Widget Your app may optionally display the Swift Shopper Cart Widget. The Swift Shopper Cart widget is a small view that is about the size of a button that displays a small rendition of a shopping cart along with the count for the number of items that are currently in the shopping cart. It is encouraged that your app place the Cart Widget in the upper right hand corner of the app’s in-app / self-scan shopping activity, and/or at the upper right hand corner of the action bar / toolbar or other navigation mechanism that your app may provide. You may do this programmatically from your activity’s Java source code or from within the layout or menu XML file editor (text mode).

Cart Widget in Layout XML To add a cart widget to an activity or fragment’s layout via XML, simply add the following XML element into a suitable view group container, such as an Android LinearLayout, FrameLayout, etc: <com.swiftshopper.sdk.ui.view.SsCartButtonView android:layout_width="wrap_content" android:layout_height="wrap_content"> By default the SsCartButtonView has no background and renders the shopping cart icon and the count of items in the color white. Hence it may seem like the SsCartButtonView does not render itself if you place the SsCartButtonView in a white area within your layout. You may specify the cart icon and item count’s color via the app:cartButtonForegroundColor property. Make sure to declare xmlsns:app=”http://schemas.android.com/apk/res-auto” namespace in the outermost XML element within your layout XML file.

Page 55 of 168

Page 56: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

For example: <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout 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:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context=".SelfScanShoppingActivity" tools:showIn="@layout/activity_self_scan_shopping">

<com.swiftshopper.sdk.ui.view.SsCartButtonView android:layout_width="wrap_content" android:layout_height="wrap_content" app:cartButtonForegroundColor="@color/colorAccent" android:elevation="10dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" />

<com.swiftshopper.sdk.ui.view.SsShopOnTheFlyView android:layout_width="match_parent" android:layout_height="match_parent" />

</android.support.constraint.ConstraintLayout>

Cart Widget in Menu XML Your app might use the standard Android Action Bar / toolbar. If so, your app might use menu XML file resources. To add the cart widget to the upper right hand corner of an activity’s action bar / toolbar, locate the activity’s corresponding menu XML file and add the following “item” element inside the “menu” element within the XML file: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android">

<item android:id="@+id/action_cart" android:title="Cart" app:actionViewClass="com.swiftshopper.sdk.ui.view.SsCartButtonView" app:showAsAction="always"/>

</menu>

Page 56 of 168

Page 57: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

By default the SsCartButtonView has no background and renders the shopping cart icon and the count of items in the color white. Hence it may seem like the SsCartButtonView does not render itself if you place the SsCartButtonView in an action bar / toolbar whose background color is white. You may explicitly set the color for the cart icon from your activity’s Java code where the activity inflates the menu / action bar / toolbar. For example: import android.view.Menu; import android.view.MenuItem; ...

import com.swiftshopper.sdk.ui.view.SsCartButtonView; …

public class SelfScanShoppingActivity extends AppCompatActivity { ...

@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu. self_scan_menu, menu); MenuItem menuItem = menu.findItem(R.id. action_cart); SsCartButtonView ssCartButtonView = (SsCartButtonView)menuItem.getActionView();

ssCartButtonView.setCartButtonForegroundColor(getResources().getColor(R.color.colorAccent)); return true; }

}

Illustrated Result The screen shot to the left shows a sample app’s self-scan shopping activity with an SsCartButtonView in both the activity’s action bar / toolbar and in the activity’s layout. In this example, the activity does not customize the SsCartButtonView’s color at all in the action bar / toolbar. However, the SsCartButtonView’s “cartButtonForegroundColor ” is defined as the app’s @color/colorAccent (magenta) in the activity’s layout XML file as follows: <com.swiftshopper.sdk.ui.view.SsCartButtonView android:layout_width="wrap_content" android:layout_height="wrap_content"

app:cartButtonForegroundColor="@color/colorAccent" android:elevation="10dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent"

app:layout_constraintTop_toTopOf="parent" />

Page 57 of 168

Page 58: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Cart Activity It is a defacto-standard for apps that display a shopping cart-like widget to display that cart’s contents when the shopping cart-like widget is displayed. We suggest that your app should define a Cart Activity whose layout consists of an SsCartView if your app renders the cart widget (SsCartButtonView ). We suggest that your app should start / display your app’s Cart Activity whenever the user taps the cart widget (SsCartButtonView ). The SsCartView is similar to the SsShopOnTheFlyView . The SsCartView is intended to fill a Cart Activity that would appear in response to the user tapping the cart widget.These are the primary differences between SsShopOnTheFlyView and SsCartView

SsShopOnTheFlyView SsCartView

● “Scan” button. ● Fully functional “Checkout” button ● Your app’s containing activity may

provide means to do other stuff such as view deals, shop from list, etc.

● Displays subtotal. ● Does not display tax. ● Does not display total.

● No “Scan” button. ● Fully functional “Checkout” button ● Your app’s containing activity should

not provide means to do other stuff.

● Displays subtotal ● Displays tax ● Displays total

Cart Activity - Layout XML Add a single view to the activity’s layout whose class is com.swiftshopper.sdk.ui.view. SsCartView whose width and height are configured to “match_parent”. For example: <?xml version="1.0" encoding="utf-8"?> < android.support.constraint.ConstraintLayout 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:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context=".CartActivity" tools:showIn="@layout/activity_cart">

< com.swiftshopper.sdk.ui.view.SsCartView android:layout_width="match_parent" android:layout_height="match_parent"/>

</ android.support.constraint.ConstraintLayout>

Page 58 of 168

Page 59: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Suggestion: Back Button in Action Bar / Toolbar From the CartActivity’s java source file, ask Android to render a back button in the activity’s action bar / toolbar. Also ask Android to navigate back when the back button is pressed in the action bar / toolbar. For example: import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar;

public class CartActivity extends AppCompatActivity {

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_cart); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar);

getSupportActionBar().setDisplayHomeAsUpEnabled(true); }

@Override public boolean onSupportNavigateUp() { onBackPressed();

return true; }

}

Suggestion: Start the Cart Activity When Cart Widget is Tapped After creating a Cart Activity within your app, start the cart activity whenever the cart widget (SsCartButtonView ) is tapped from any activities / fragments within your app that display a cart widget.

Cart Widget in the Action Bar / Toolbar Here is how to start the Cart Activity when a cart widget (SsCartButtonView ) is tapped from one of your app’s activity’s action bar / toolbar:

Page 59 of 168

Page 60: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

1. Open the java source file for the activity(ies) whose action bar / toolbar provides a cart

widget. 2. Locate the code that inflates the activity’s menu:

public class SelfScanShoppingActivity extends AppCompatActivity { ...

@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.self_scan_menu, menu); return true; }

...

}

3. Define the “on click” listener for the menu item’s “action view” that corresponds to the cart widget with logic that starts your app’s Cart Activity: public class SelfScanShoppingActivity extends AppCompatActivity { ...

@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.self_scan_menu, menu); menu.findItem(R.id.action_cart).getActionView().setOnClickListener((v)->{ startActivity(new Intent(SelfScanShoppingActivity.this, CartActivity.class)); });

return true; }

...

}

Cart Widget in Activity’s Layout Here is how to start the Cart Activity when a cart widget (SsCartButtonView ) located / defined in the activity’s layout is tapped:

1. Open the java source file for the activity(ies) whose layout includes a cart widget.

Page 60 of 168

Page 61: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

2. Locate the code that inflates the activity’s layout: public class SelfScanShoppingActivity extends AppCompatActivity { ...

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_self_scan_shopping); ...

}

...

}

3. Define the “on click” listener for the cart widget with logic that starts your app’s Cart Activity: public class SelfScanShoppingActivity extends AppCompatActivity { ...

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_self_scan_shopping); findViewById(R.id.cart_widget).setOnClickListener((v)->{ startActivity(new Intent(SelfScanShoppingActivity.this, CartActivity.class)); });

...

}

...

}

Page 61 of 168

Page 62: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Order History It is customary for apps that provide a shopping experience to also provide a means for the user to view details about previous purchases that the user has made from the app. The Swift Shopper SDK provides a view that can be added to any activity, fragment, etc. within your app to display the user’s order history. This view presents a list of the user’s most recent orders for any stores at the retailer to which your app is registered (via your app’s Swift Shopper SDK Key). The user may tap any item within the “order history” list to view details about the selected order. This functionality is provided automatically via the Swift Shopper SDK. Perhaps the most challenging part to you (the app developer) will be to decide from where within your app to provide the user the option to view their order history. For example, Swift Shopper’s apps tend to feature a “hamburger” menu that is available on strategic screens within the app located in the upper left of the action bar / toolbar. Swift Shopper’s apps then tend to place an “Order History” item in the “hamburger” menu. It is up to you to decide whether to allow your users to view their order history, and where in your app you’d like to present the user with the option / navigation means to view their order history. The procedure for constructing the order history activity is essentially the same as the procedure for creating the “Cart Activity”, or any activity that displays a view from the Swift Shopper SDK:

1. Add an activity to your app (or you may even reuse an activity scene if you’d prefer). 2. Add a com.swiftshoper.sdk.ui.view.SsOrderHistoryView to the activity’s layout 3. Identify where in your app the option to view order history should be presented (perhaps

from a “hamburger” menu or anywhere that you choose.) 4. Add a button, menu item, etc. labelled “Order History” (or perhaps you may choose to

render the button as an icon or graphic that represents “order history”). 5. Add an on-click listener to the chosen button, menu item, etc with source code that

navigates the user to the “Order History” activity after the button is tapped. 6. Consider designing the app so that any action bar or toolbar is reused for the “Order

History” activity thereby providing ‘back’ navigation automatically (or otherwise design the navigation means for the user to subsequently use to navigate away from the “Order History” activity when the user is finished viewing their order history).

Page 62 of 168

Page 63: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Shopping Lists In addition to self-scan mobile checkout, Swift Shopper provides functionality that allows users to create shopping lists. A user may create any number of named shopping lists and add shopping items to their shopping lists. The list sharing feature is available if the user is logged into Swift Shopper via the app (as opposed to being logged in anonymously). Users may create, edit, update, and share lists even if the user is not currently shopping at a store via the app. When checked into a store, the user interface for the shopping list functionality is customized to help the user to shop using their shopping lists as a guide. For example, the Swift Shopper SDK renders a small scanner button next to each item in the user’s shopping list. When the user taps the small scanner button next to a shopping list entry, the Swift Shopper SDK presents the scanner screen whereby the user may scan a barcode. The Swift Shopper SDK then knows that the shopping list entry has been scanned to the user’s cart. When the user completes checkout at the store via the app, the shopping list entry will automatically be crossed off of the shopping list. Moreover, if the shopping list is a shared list, the same shopping list entry will likewise be crossed off the list when another user views the same shared list. (This allows members of the same household, for example, to know that somebody else has purchased the item.) Although shopping lists are a nice feature that your app may choose to provide, a complexity arises when your app presents the shopping experience to the user. Some users may wish for a simple self-scan shopping experience that is equivalent to the “In App Shopping” scene described in the “Basic Self-Scan Shopping” section, whereas other users may wish for a customized shopping experience that is integrated with their shopping lists. Hence, the complexity involved is to provide the user the choice of shopping either with integrated list support or via the simplified “Basic Self-Scan Shopping” experience as described in the “Basic In-Store Shopping” section.

Page 63 of 168

Page 64: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Scenario: View/Edit Shopping Lists (Support Only When Not Shopping) Simply add a com.swiftshopper.sdk.ui.view.SsListView to any activity or fragment in your app and provide a means for the user to navigate to the activity or fragment. Assuming that the app is not checked into a store, the user will then experience full shopping list support when the user views the corresponding activity or fragment in the app.

Scenario: View/Edit Shopping Lists (Support Only While Shopping) The same SsListView that is described in the previous section can be used to provide the user with a customized shopping experience. Simply display any activity that includes the SsListView within its layout after rendering the Select Market Activity (multiple retailer store support) or after your app calls the SwiftShopperSdk.enterStore(...) method as described in the Basic Self-Scan Shopping / Single Location Support section. The SsListView will then render itself slightly differently. The user will still be able to view and edit their shopping lists. In addition, the user will see a “Scan to Cart” button and checkout button located within the SsListView ; along with a small scanner button beside the items in their shopping lists. Any scanned items will be added to the shopping cart and automatically crossed off of the user’s shopping lists. The user can initiate checkout directly from the SsListView to pay for their groceries in the app or at the register without having to scan the individual items at the cash register in the store.

Scenario: View/Edit Shopping Lists (Support When Either Shopping or Not Shopping) To support shopping lists either when checked into a store or when not checked into a store, it is suggested that you use a single activity or fragment for the shopping list. Provide a means to navigate to this activity or fragment when checked into a store and also when not checked into a store. The SsListView in the activity / fragment will render itself appropriately when the app is checked into a store versus not checked into a store. Although the SsListView renders itself appropriately when the app is checked into a store versus not checked into a store, it is suggested that the SsListView’s containing activity /

Page 64 of 168

Page 65: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

fragment include a cart widget only when the activity / fragment is rendered and the user is checked into a store. It is suggested that the activity’s title should perhaps be updated to indicate that the user is shopping from a list when the activity is displayed and the user is checked into a store. Conversely, it is suggested that the activity’s title should perhaps indicate that the user is viewing / editing or “planning” their shopping list when the activity is displayed yet the user is not checked into a store. You should also consider providing a means for the user to switch back and forth between the self-scan activity and the shopping list activity when the user is checked into a store. In addition, you should consider providing a means to view in-store deals from the self-scan activity and the shopping list activity if your app provides the user the ability to view in-store deals.

Page 65 of 168

Page 66: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Shared Shopping Lists The SsListView features a share button that a user may click to share their list with another user. The share button is rendered when either (a) the user is non-anonymously logged in and/or (b) your AndroidManifest.xml file declares your app’s login activity with the following intent filter: <activity android:name="FULLY QUALIFIED NAME OF YOUR APP’S LOGIN ACTIVITY" android:label="STRING RESOURCE FOR YOUR LOGIN ACTIVITY’S TITLE" android:theme="@style/AppTheme.NoActionBar">

<intent-filter> <action android:name="com.swiftshopper.sdk.LoginForPrivateShare"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> </application> As default functionality, when this happens a text or email message with a URL link is generated and passed to Android. Android then prompts the user whether to share via text or email. The user chooses text or email. Android then walks the user through the process of texting or emailing the message to the other user. The other user then receives the message, clicks the link in the message, your app then opens on the other user’s device, and the first user’s list is imported into the second user’s instance of your app.

Minimal Behavior Needed From Your App Your app needs to do the following to minimally support the second user when the second user taps the link that the second user receives from the first user in the use case scenario described in the previous section:

1. Implement a Shopping List Activity that includes a com.swiftshoper.sdk.ui.view. SsListView in the activity’s layout.

Page 66 of 168

Page 67: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

2. Override the onNewIntent(...) method and call setIntent(intent)

public class ShoppingListActivity extends AppCompatActivity { ...

@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); setIntent(intent);

}

...

}

This ensures that the activity retains the latest intent, even if Android has simply brought the activity back into focus as opposed to starting the activity for the first time. This is necessary since Android could restart this activity if the user taps a link / URL from outside of the app to view another user’s shared list (see step 4 below and step 4’s subsequent explanation).

3. Override the onStart(...) method and call SwiftShopperSdk.importSharedList(this)

method. public class ShoppingListActivity extends AppCompatActivity { ...

@Override public void onStart( ) { SwiftShopperSdk.importSharedList(this); ...

super.onStart(); }

...

}

The SwiftShopperSdk.importSharedList(Activity…) method evaluates the activity’s most recent intent. In the scenario where the activity is started or restarted due to the user tapping a link / URL from outside of the app to view another user’s shared list, the activity’s intent will encapsulate the link / URL. The SwiftShopperSdk.importSharedList(Activity…) method extracts the information about the shared list and imports the list into the user’s account, thereby causing the list to appear in the SsListView that the activity displays. The next step and the instilling explanation describes this further.

Page 67 of 168

Page 68: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

4. Declare your app’s Shopping List Activity in your app’s AndroidManifest.xml file as

follows:

<activity android:name="YOUR SHOPPING LIST ACTIVITY’S FULLY QUALIFIED NAME WITH JAVA PACKAGE PATH"

android:label="YOUR STRING RESOURCE FOR THE SHOPPING LIST ACTIVITY’S NAME" android:launchMode="singleTask" android:theme="@style/AppTheme.NoActionBar">

<!-- list.swiftshopper.com intent filter-->

<intent-filter android:label="YOUR STRING RESOURCE TO APPEAR IN THE ANDROID ‘OPEN WITH’ DIALOG WHEN USER TAPS A SHARED-LIST

URL TO ACCESS A SHARED LIST. SUGGESTED STRING =

‘Your Application Name: View List’"> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> <data android:scheme="http" android:host="list.swiftshopper.com" android:pathPrefix="/import"/> </intent-filter> <!-- sslistshare intent filter -->

<intent-filter android:label="YOUR STRING RESOURCE TO APPEAR IN THE ANDROID ‘OPEN WITH’ DIALOG WHEN USER TAPS A SHARED-LIST URL

TO ACCESS A SHARED LIST. SUGGESTED STRING =

‘Your Application Name: View List’"> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> <data android:scheme="sslistshare"/> </intent-filter>

<!-- com.swiftshopper.sdk.ShareListAfterLogin intent filter -->

<intent-filter> <action android:name="com.swiftshopper.sdk.ShareListAfterLogin"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter>

</activity>

Explanation: lists.swiftshopper.com intent filter When a user (User A) views your app’s Shopping List Activity and taps the ‘Share List’ button, the default Swift Shopper SDK functionality generates a simple text message with a URL that starts with http://lists.swiftshopper.com/import followed by data that identifies User A’s shopping

Page 68 of 168

Page 69: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

list. The default Swift Shopper SDK functionality then invokes the standard Android mechanism to share this as text. As a result Android prompts the user to choose to proceed via one of the user’s text or email apps. User A then sends the message or email to another user (User B) via the text or email app that User A selects. User B then receives the simple text message from User A and taps the URL in the message. The lists.swiftshopper.com intent-filter causes your app to inform Android that your app may be launched displaying your app’s Shopping List Activity whenever a user taps a URL from an app such as the user’s messaging or email app if the URL starts with http://lists.swiftshopper.com/import. Thanks to the lists.swiftshopper.com intent-filter, when User B taps the URL that User B receives from User A, Android will prompt the user to choose between the Web Browser and your app (and any other retailer apps that the user might have installed that use the Swift Shopper SDK’s default list sharing mechanism). Android displays the android:label text that you define in the lists.swiftshopper.com intent-filter as the text that describes your app during this prompt. Ideally User B chooses your app. Then Android launches your app, starts your app’s Shopping List Activity, and places the URL in an activity intent that is either pass to your activity’s onNewIntent method or set as the intent that the activity’s Java code could hypothetically access by calling the getIntent method if and only if Android is launching your Shopping List Activity for the first time since the app most recently started. In either case the intent is available via the getIntent() method since your app’s onNewIntent(intent) method calls setIntent(intent) as instructed a few paragraphs ago. Since your shopping list activity’s onStart method always calls SwiftShopperSdk.

importSharedList(this) per these instructions, and since the intent that encodes the shared list URL is assigned as the activity’s intent per these instructions, the Swift Shopper SDK knows that there is a pending shared list to import the next time that an SsListView appears on the screen. Android then proceeds to render your Shopping List Activity on the screen. Your Shopping List Activity includes an SsListView within the activity’s layout. While initializing itself, the SsListView automatically evaluates the activity’s intent, detects that the intent encodes a URL that starts with http://lists.swiftshopper.com/import, extracts the information about User A’s list from the data that is encoded in the URL, imports User A’s shopping list into User B’s account, and displays the list.

Page 69 of 168

Page 70: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Explanation: sslistshare intent filter As previously described, when User B receives the simple text message from User A and clicks the http://lists.swiftshopper.com/import URL, Android prompts User B to choose from your activity or the web browser. Ideally User B chooses your app. However, if User B chooses the web browser, the web browser is launched and navigates to the http://lists.swiftshopper.com/import?... URL. A web server in the Swift Shopper cloud then serves a page to the web browser. The JavaScript logic in the web page executes in User B’s web browser and attempts to launch your app. This logic attempts to leverage both the lists.swiftshopper.com and sslistshare intent filters. The sslistshare intent filter defines a custom URL scheme that starts with sslistshare://... Moreover, the sslistshare intent filter informs Android that your app’s Shopping List Activity should be launched whenever the system attempts to visit a URL that starts with sslistshare://… Hence the sslistshare intent filter helps ensure that your app is launched when User B taps the URL but chooses to open the URL in the web browser instead of your app.

Explanation: com.swiftshopper.sdk.ShareListAfterLogin intent filter The com.swiftshopper.sdk.ShareListAfterLogin intent filter supports the scenario whereby the user could be viewing your app’s shopping list activity but either not logged in or logged in anonymous. List sharing requires that the user be logged in non-anonymously. By default the SsListView does not render the “Share List” button at all if the user is logged in anonymously or not logged in at all. However, if you’d like for your user to still have the “Share List” button in this scenario, you must define 2 intent filters: (a) the com.swiftshopper.sdk. ShareListAfterLogin intent filter for your Shopping List Activity and (b) the com.swiftshopper. sdk.LoginForPrivateShare intent filter for your app’s Login Activity. In order to fully understand the com.swiftshopper.sdk.ShareListAfterLogin intent filter, it is necessary to first understand the com.swiftshopper.sdk.LoginForPrivateShare intent filter.

1. Help the Swift Shopper SDK’s default list sharing functionality to find your app’s Login activity.

Page 70 of 168

Page 71: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

2. Define the com.swiftshopper.sdk.LoginForPrivateShare intent filter on your

app’s Login Activity in your AndroidManifest.xml file: <activity android:name="com.swiftshopper.sdk.quickstart.LoginActivity" android:label="@string/title_activity_login" android:theme="@style/AppTheme.NoActionBar"> <intent-filter> <action android:name="com.swiftshopper.sdk.LoginForPrivateShare"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> When the SsListView renders itself and the user is either not logged in or logged in anonymously, the SsListView asks Android if there is any activity in your app that defines the com.swiftshopper.sdk.LoginForPrivateShare intent filter. If so, the SsListView renders the “Share List” button. Otherwise the SsListView hides the “Share List” button. The SsListView starts your app’s Login Activity via the “com.swiftshopper.sdk. LoginForPrivateShare” intent filter when the “Share List” button is clicked if the user is not logged in or logged in anonymously. Assuming that your app’s LoginActivity includes the com.swiftshopper.sdk.ui.view.SsLoginView within its layout, the SsLoginView appears and checks whether its activity was launched via the com.swiftshopper.sdk.LoginForPrivateShare intent filter. If yes, then the SsLoginView knows that the user needs to be returned to your app’s shopping list activity after logging in, and your shopping list activity’s SsListView needs to then proceed to share the list. After the user logs in, the SsLoginView (knowing that the activity was presumably launched in response to the user tapping the “Share List” button from an SsListView ) then finds and starts your app’s shopping list activity via the com.swiftshopper.sdk.LoginForPrivateShare intent filter, which informs the SsListView thereon to subsequently proceed to share the list.

2. Help the SsLoginView then find your Shopping List activity so that it can redirect the user back to the Shopping List Activity, and tell the Shopping List Activity to subsequently share the user’s list. This is where the com.swiftshopper.sdk.ShareListAfterLogin intent-filter comes into play for your Shopping List Activity.

Page 71 of 168

Page 72: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Explanation: Launch Mode Single Task When a user (User B) taps a URL / link in an external application to view another user’s (User A’s) shared list, Android starts your shopping list activity. Without the “Single Task” launch mode, Android would create a new instance of your activity and place it as a task within the external app’s back-stack. As a result, if the user ever switches tasks (via the Android recents menu) back to their external (SMS / messaging or email app), your app’s shopping list activity would appear since Android would have placed the instance within the external app’s back-stack. By declaring the launch mode as Single Task, you instruct Android to not allow this additional task to be created and thereby prevent Android from placing your shopping list activity into the external app’s back-stack.

Login Activity - Intent Filters The previous page or two has already explained how your login activity needs to declare an intent-filter in your AndroidManifest.xml file for the com.swiftshopper.sdk.

LoginForPrivateShare intent. Your login activity needs two additional intent filters to facilitate the various scenarios that can occur when a user attempts to share a shopping list or create a link to a shopping list when the user is not logged int. In total, your AndroidManifest.xml file should declare the following following intent filters for your app’s login activity: <activity android:name=".LoginActivity" android:label="@string/title_activity_login" android:launchMode="singleTask" android:theme="@style/AppTheme.NoActionBar"> <intent-filter> <action android:name="com.swiftshopper.sdk.LoginForPrivateShare"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> <intent-filter> <action android:name="com.swiftshopper.sdk.LoginForPublicShare"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> <intent-filter> <action android:name="com.swiftshopper.sdk.LoginToViewSharedList"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity>

Page 72 of 168

Page 73: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Optimized Behavior Suggested From Your App The default (minimal) behavior described so far is not the most ideal nor the most seamless of a user experience when the second user taps the link that the second user receives from the first user. The default minimal behavior’s text / email message provides a link that the receiving user may tap assuming that the user has already installed your app. However, the user will need to understand and know how to install your app, and then click the link after the app is installed. It would be better if the second user could simply tap the link that the second user receives and then be walked through whatever might need to happen in order for the second user to access the first user’s shopping list. Your app will need to do some more work in order to support this ideal, seamless integration. A third-party service called Branch IO provides the functionality that you will need. Depending on whether or not you are familiar with Branch IO, and depending on how much experience you have at receiving and handling URLs in your AppDelegate, this procedure could take anywhere from perhaps 4 hours to 2 or 3 days to develop. Here are the steps:

Sign-up For an Account With “Branch.io” ● Visit https://branch.io ● Sign up for a developer account ● Familiarize yourself with the branch.io development documentation ● Add your app to your developer account ● Configure your app’s link settings within branch.io (as described in the branch.io

developer documentation) ● Download your app’s branch.io key file. ● Add ‘branch’ to your app’s list of dependencies in your app’s build.gradle file (as

described in the branch.io developer documentation) ● Add your app’s branch.io key as meta data to the AndroidManifest.xml file (as described

in the branch.io developer documentation)

Customize the Text / Email Message from First User to Second User ● Open your app’s Shopping List Activity that includes the SsListView in its layout. ● Make the Shopping List Activity implement the SsListView.ShareListDelegate interface

import com.swiftshopper.sdk.ui.view.SsListView; ...

public class ShoppingListActivity extends AppCompatActivity implements SsListView.ShareListDelegate { …

}

Page 73 of 168

Page 74: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

● From the Shopping List Activity’s onCreate method, get a reference to the

SsListView (perhaps via the findViewById method or perhaps via Android binding), and call the setShareListDelegate(...) method on the SsListView reference and pass in this. public class ShoppingListActivity extends AppCompatActivity { ...

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_shopping_list); …

SsListView ssListView = findViewById(R.id.shopping_list_view); ssListView.setShareListDelegate(this); ...

}

...

}

● Implement the shareList(int listId, int shareTypeId) method in your Shopping List Activity. public class ShoppingListActivity extends AppCompatActivity { ...

@Override public void shareList(int listId, int shareTypeId) { ...

super.onCreate(savedInstanceState); setContentView(R.layout.activity_shopping_list); …

SsListView ssListView = findViewById(R.id.shopping_list_view); ssListView.setShareListDelegate(this); ...

}

...

}

● Use branch.io to generate a deep link URL that encodes the given listId and

shareTypeId ● Construct a custom message for the first user to send to the second user ● Create the deep link URL via io.branch.referral.util.LinkProperties and io.branch.indexing.

BranchUniversalObject as documented in the branch.io developer documentation. ● Place the custom message and the deep link URL inside and Android Intent as follows:

Page 74 of 168

Page 75: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.app_name) + " Share List"); sendIntent.putExtra(Intent.EXTRA_TEXT, "Hey checkout my list with " + context.getString(R.string.app_name) + "! \n" + yourBranchIoGeneratedUrl);

sendIntent.setType("text/plain");

● Then ask Android to ask the user to share the message: Intent intent = Intent.createChooser(sendIntent, "Share Via"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);

Detect When the Second User Clicks the Shared List Link Background The previous section shows how to implement your app so that the first user sends a text or email message to the second user when the first user decides to share their list. When the second use receives the text or email and subsequently clicks the URL link that is in the text or email, a Branch I/O web site is retrieved in the user’s web browser. Branch IO then executes some logic in the user’s web browser that ascertains whether the app is installed. The second user is taken to the screen within the Play Store for downloading your app if the second user does not have your app installed. Branch IO leverages an Android feature known as “app links” to essentially ask Android to pass a URL with URL parameters to your app when the second user launches the app after installing your app. To support the “app link” feature, Branch IO will instruct you via Branch IO’s developer documentation to register an intent filter into your app that specifies the beginning portion of the HTTPS “app link”. Hence, when the second user taps the link in the message / email, the link is a specially formatted Android app link. Since your app is registered with an intent filter that specifies the beginning portion of the app link, Android launches your app and passes the entire URL, including the URL parameters, into your app if your app is installed. Otherwise, Android navigates the user to your app’s download page in the Play Store. After installing your app and launching your app for the first time, Android passes the same URL, including the URL parameters into your app. The app link’s URL parameters encode the shared list id and shared list type parameters, which the Swift Shopper SDK needs in order to import the shared list into the second user’s login.

Page 75 of 168

Page 76: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Development Steps

● The branch i/o developer document instructs you to add intent filters with a custom scheme and http + https scheme with android:host values for the URL that branch I/O generates when the first user shares their list. We suggest that you add these intent filters on your app’s Main / Home Activity

● From the Main / Home Activity’s onStart or onResume method, check if the activity was launched via the Branch.io app link: Branch. getInstance().initSession((branchUniversalObject, linkProperties, error) -> { if (error == null) { String listId = ""; String shareType = ""; if (branchUniversalObject != null && branchUniversalObject.getContentMetadata() != null) HashMap<String, String> customMetaData =

branchUniversalObject.getContentMetadata().getCustomMetadata();

if (customMetaData.containsKey(“list_id”) { listId = customMetaData.get(“list_id”);

}

if (customMetaData.containsKey(“share_type”)) { shareType = customMetaData.get(“share_type”);

}

try { SwiftShopperSdk.importSharedList(listId, shareType); startActivity(new Intent(MainActivity.this, ShoppingListActivity.class);

} catch (SwiftShopperSdk.SsListParamsException e) { // Bad listId or shareType

e.printStackTrace();

} catch (SwiftShopperSdk.SsLoginStateException e) { // TODO: Update the LoginActivity’s login-success listener to check if there is a

pending

// shared list (HINT: call SwiftShopperSdk.hasPendingSharedListForImport() and launch

the

// Shopping List Activity immediately after the user logs in. The Shopping List

Activity’s

// SsListView will complete the process of importing the shared list and display the

list

startActivity(new Intent(MainActivity.this, LoginActivity.class); }

Branch.getInstance().resetUserSession(); }

}

}, intent.getData(), appCompatActivity);

Page 76 of 168

Page 77: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

More Notes About Branch IO As of the time that this document is being authored, the comprehensive deep link functionality that Branch IO provides is free. All you have to do is sign up for a developer account and follow the Branch IO development instructions. Swift Shopper has absolutely no affiliation with Branch IO. In theory anybody can implement all of this deep link and app link functionality themselves without using Branch IO. However, since Branch IO has already solved this problem, and since Branch IO provides this solution for free, Swift Shopper therefore suggests using Branch IO to achieve this functionality. In fact, Swift Shopper uses Branch IO for all Swift Shopper apps that support a user receiving a shared list from another user.

Page 77 of 168

Page 78: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Viewing Deals Swift Shopper retailers may integrate their advertised deals into the Swift Shopper infrastructure. For any such retailer, your app may provide a means for the user to browse the advertised deals that are currently available at the retailer. The process for displaying the retailer’s current deals is similar to the process for displaying any of the Swift Shopper SDK’s graphical components, such as the process described for the “Cart Activity”:

1. Create an activity (or choose an existing activity to reuse) 2. Add a com.swiftshopper.sdk.ui.view.SsDealView to the activity’s layout, and position it

where you desire. Give it a prudent amount of real estate on the screen. Perhaps tinker around, view the result in a live running app, adjust size accordingly, etc.

3. Add a means within your app for the user to navigate to the activity to see the deals 4. Suggestion: Ensure that a navigation mechanism exists for the user to “go back” or

otherwise navigate away after viewing the deals. Note that if the app is checked into a store, the user will have an option to scan any deal into the shopping cart. Therefore, it is suggested that the “Cart Widget” be placed on the deals screen, perhaps in the upper-right hand corner, either within the activity’s layout or within the activity’s action bar / toolbar. However, if your app presents the deals screen even when the user is not shopping in a store then your app should hide or otherwise not display the “Cart Widget” unless the user is currently checked into a store. As previously described, you may call SwiftShopperSdk.getStore() to determine whether the app is currently checked into one of the retailer’s brick-and-mortar stores. The SwiftShopperSdk.getStore() method returns a non-null object with information about the store if the app is currently checked into a retail store, otherwise SwiftShopperSdk.getStore() returns null.

Page 78 of 168

Page 79: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

User Profile It is customary for apps that include a means for the user to “log in” to also provide a mechanism for a user to view their user profile. The Swift Shopper SDK features the com.swiftshopper.sdk.ui.view.SsProfileView view component that your app may place on an activity that your app may provide for the user to view their profile. The SsProfileView displays the following:

● The user’s name ● The user’s profile image ● The number of times that the user has entered a store via your app. ● The number of items that the user has ever scanned while shopping at a store via your

app. ● The number of times that the user has completed check-out at a store via your app.

The process for displaying the user’s profile is similar to the process for displaying any of the Swift Shopper SDK’s graphical components.

1. Create an activity (or choose an existing activity to reuse) 2. Add the following element to the activity’s layout XML:

<com.swiftshopper.sdk.ui.view.SsProfileView android:id="@+id/ssProfileView" android:layout_width="match_parent" android:layout_height="match_parent"/>

3. Add a means within your app for the user to navigate to the activity whose layout includes the SsProfileView

4. Suggestion: Ensure that a navigation mechanism exists for the user to “go back” or otherwise navigate away after viewing their profile.

Page 79 of 168

Page 80: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Appendix 1: Class Reference

com.swiftshopper.sdk.SwiftShopperSdk

Purpose The SwiftShopperSdk class provides static functions that a 3rd party app calls to integrate the app with the Swift Shopper SDK. An app must first call the initialize method then the app may call any other public static methods upon this class, and / or include any view components from the com.swiftshopper.sdk.ui.view package onto any activity, fragment, or layout thereon within the app.

Static Methods

Static Method

initialize Entry point to initialize the SwiftShopperSdk SDK. Should be called from the overridden onCreate(...) method from the app’s Application class.

public class SampleApplication extends Application {

@Override

public void onCreate() {

super.onCreate();

SwiftShopperSdk.initialize(new SsConfig.Builder(this)

.setRetailerSdkKey("...")

.setSmallLogo(R.mipmap.ic_...)

.setLargeLogo(R.mipmpa.ic_...)

.setActivityTheme(R.style.AppTheme_NoActionBar)

.setThemeColor(ResourcesCompat.getColor(

getResources(), R.color.colorPrimary, null))

.build());

}

}

Parameters

Name: Type: Description:

Page 80 of 168

Page 81: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

ssConfig SsConfig The SsConfig object that encapsulates the various settings used for initialization.

Return Value

None

Page 81 of 168

Page 82: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Static Method

scanItemToCart(SsScanResultListener) Opens the "Scan to Cart Item" activity to prompt the user to scan a barcode. The corresponding product will be added into the user's shopping cart and the given listener will be called and passed the raw barcode that was scanned. The "Scan to Cart Item" activity will be opened using Android Intent flag FLAG_ACTIVITY_NEW_TASK. Call scanItemToCart(Activity, SsScanResultListener) instead if you wish for the "Scan to Cart Item" to be opened as a sub-task of a particular activity within your app. 3rd party apps can call this method to manually build a user interface that has their own a "Scan" button. A 3rd party app may wish to use this functionality to gain access to the barcode that the user scans. See also:

● SsScanResultListener ● SsScanResult

Parameters

Name: Type: Description:

ssScanResultListener

SsScanResultListener

a listener to receive the result of the scan

Return Value

None, however the given SsScanResultListener will receive a callback with the result of the prompt to ask the user to scan an item into the user’s shopping cart.

Page 82 of 168

Page 83: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Static Method

scanItemToCart(Activity, SsScanResultListener) Opens the "Scan to Cart Item" activity to prompt the user to scan a barcode. The corresponding product will be added into the user's shopping cart and the given listener will be called and passed the raw barcode that was scanned. 3rd party apps can call this method to manually build a user interface that has their own a "Scan" button. A 3rd party app may wish to use this functionality to gain access to the barcode that the user scans. See also:

● SsScanResultListener ● SsScanResult

Parameters

Name: Type: Description:

parentActivity Activity the "Scan to Cart Item" activity is started as a subtask of this activity

ssScanResultListener

SsScanResultListener

a listener to receive the result of the scan

Return Value

None, however the given SsScanResultListener will receive a callback with the result of the prompt to ask the user to scan an item into the user’s shopping cart.

Page 83 of 168

Page 84: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Static Method

login(LoginData, LoginListener) Logs into Swift Shopper using the given loginData.

Parameters

Name: Type: Description:

loginData

LoginData

important information about the user's login, including social media login token, etc.

loginListener

LoginListener

an object of yours that will receive an asynchronous callback upon success or failed login.

Return Value

None, however, the given loginListener receives a callback indicating success or failure.

Page 84 of 168

Page 85: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Static Method

login(Activity, LoginData, LoginListener) Logs into Swift Shopper via the app's login activity. It is beneficial to call this rendition of the login method as opposed to login(LoginData, LoginListener) method in that this rendition will call the given activity’s setResult(int) method accordingly to make things easier for your app to support user login when a non-logged-in user attempts to share a shopping list.

Parameters

Name: Type: Description:

loginActivity

Activity

the app's activity from which the user is logging in

loginData

LoginData

important information about the user's login, including social media login token, etc.

loginListener

LoginListener

an object of yours that will receive an asynchronous callback upon success or failed login.

Return Value

None, however, the given loginListener receives a callback indicating success or failure.

Page 85 of 168

Page 86: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Static Method

loginAnonymous(LoginListener) Anonymously logs into Swift Shopper. This is called to implement "Skip Login" functionality. Even though the user believes that they have skipped login, Swift Shopper still needs to create anonymous tracking information about the user in order to save their settings, store purchase history, etc.

Parameters

Name: Type: Description:

loginListener

LoginListener

an object of yours that will receive an asynchronous callback upon success or failed login.

Return Value

None, however, the given loginListener receives a callback indicating success or failure.

Page 86 of 168

Page 87: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Static Method

importSharedList(Activity) Requests that a shared list be loaded on behalf of the given activity if Android launched the activity due to the user invoking a shared list URL on their device perhaps by tapping a shared list URL from their messaging or email app. The given activity presumably renders a com.swiftshopper.sdk.ui.view.SsListView within the activity's content / layout. The given activity may or may not have been launched by Android due to the user tapping a shared list URL. If launched due to tapping a shared list URL, the shared list wil be imported into the current user's account and displayed whenever any com.swiftshopper.sdk.ui.view. SsListView instance is subsequently rendered; provided that the user is fully logged in. (Fully logged in means BOTH logged in and NOT anonymous.)

Parameters

Name: Type: Description:

activity

Activity

an Activity that is currently starting and that Android could have potentially launched due to the user tapping a shared list URL, although the Activity may or may not have been actually launched for this reason. Any such activity presumably renders a com.swiftshopper.sdk.ui.view. SsListView. If the activity was indeed launched by Android due to the user tapping a shared list URL, the shared list will be imported into the user's account (provided that the user is fully logged in) and automatically selected to be displayed in the com.swiftshopper.sdk.ui.view.SsListView when it is rendered.

Return Value

None, however the given activity will display a toast if the user is not logged in or if the activity was launched due to the user tapping a shared list URL yet the logic herein is unable to successfully parse the shared list URL. The toast message can be customized via the app's string resources (R.string.shared_list_imported_but_not_logged_in and

Page 87 of 168

Page 88: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

R.string.shared_list_link_validation_error)

Static Method

importSharedList(Intent) Requests that a shared list be loaded into the user’s account and displayed the next time that any com.swiftshopper.sdk.ui.view. SsListView is rendered.

Parameters

Name: Type: Description:

activityIntent

Intent

An Activity’s Intent as potentially retrieved via the Activity’s getIntent() method that Android has presumably used to launch the Activity in the app as a result of a shared list URL being invoked in the device. This Intent encodes the shared list URL within the Intent’s data that the Intent’s getData() method returns.

Return Value

None

Exceptions

Type: Description:

SsListMissingException

Thrown if the given intent is null, has no data, has data but the URI scheme is neither http nor https, the URI has a hostname other than the host name that the app passed to SsConfig.Builder.setSharedListHost(String) for the SsConfig object that the app passes to the SwiftShopperSdk. initialize(SsConfig) method, the URI has a path other than the path that the app passed to SsConfig.Builder. setSharedListPath(String) for the SsConfig object that the app passes to the SwiftShopperSdk.initialize(SsConfig) method, the URI does not encode a query parameter that matches the parameter name that the app passed to SsConfig.Builder.setSharedListIdParam(String) for the SsConfig object that the app passes to the SwiftShopperSdk.initialize(SsConfig) method, or the URI does not encode a query parameter that matches the

Page 88 of 168

Page 89: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

parameter name that the app passed to SsConfig.Builder. setSharedListShareTypeIdParam(String) for the SsConfig object that the app passes to the SwiftShopperSdk. initialize(SsConfig) method.

SsListParmsException Thrown if the given intent seems to encode a shared list URI but the expected query parameters within the URI have the wrong data format

SsLoginStateException Thrown if the user is either not logged in or logged in anonymously. The list will still be imported and displayed the next time that any com.swiftshopper.sdk.ui.view.SsListView object is rendered after the user is fully logged in assuming that the user does not close the app prior to fully logging in.

Page 89 of 168

Page 90: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Static Method

importSharedList(int, int) Requests that a shared list be loaded into the user’s account and displayed the next time that any com.swiftshopper.sdk.ui.view. SsListView is rendered.

Parameters

Name: Type: Description:

int

listId

The Swift Shopper globally unique identifier for the shared list.

int shareTypeId The Swift Shopper identifier that indicates the type of share.

Return Value

None

Exceptions

Type: Description:

SsLoginStateException

Thrown if the user is either not logged in or logged in anonymously. The list will still be imported and displayed the next time that any com.swiftshopper.sdk.ui.view.SsListView object is rendered after the user is fully logged in assuming that the user does not close the app prior to fully logging in.

Page 90 of 168

Page 91: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Static Method

importSharedList(String, String) Requests that a shared list be loaded into the user’s account and displayed the next time that any com.swiftshopper.sdk.ui.view. SsListView is rendered.

Parameters

Name: Type: Description:

String

listId

The Swift Shopper globally unique identifier for the shared list. Although this parameter is a String, the value must be a string representation of an int.

String shareTypeId The Swift Shopper identifier that indicates the type of share. Although this parameter is a String, the value must be a string representation of an int.

Return Value

None

Exceptions

Type: Description:

SsListParmsException Thrown if the given listId is null, empty string, or cannot be converted to an int; or if the given shareTypeId is null, empty string, or cannot be converted to an int

SsLoginStateException

Thrown if the user is either not logged in or logged in anonymously. The list will still be imported and displayed the next time that any com.swiftshopper.sdk.ui.view.SsListView object is rendered after the user is fully logged in assuming that the user does not close the app prior to fully logging in.

Page 91 of 168

Page 92: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Static Method

hasPendingSharedListForImport() Indicates whether a rendition of importSharedList has been called but the corresponding shared list is still waiting to be imported. NOTE: Any shared list that is passed to any rendition of the importSharedList method will be automatically imported the next time that any com.swiftshopper.sdk.ui.view.SsListView appears on the screen, provided that the user is logged in. For example, your app may register an intent filter for an activity to be launched when the user taps a deep link from another app on their device whereby the deeplink represents a shared list. Your app's activity may then call importSharedList(String, String) . The importSharedList(String, String) method will accept the information about the list but throw SsLoginStateException if the user is not logged in. Your app's logic may then educate / instruct the user that the user needs to log in, and you app may forward the user to your app's login activity. Assuming the user logs in from your app's log-in activity, your app's post-processing logic for after the login may call this method to see if there is a shared list pending for import. Your login activity may then start your app's list viewing activity whose layout includes a com.swiftshopper.sdk. ui.view.SsListView if this method returns true. The com.swiftshopper.sdk.ui. view.SsListView will proceed to load the shared list into the user's account and display the contents of the shared list.

Parameters

None

Return Value

Returns true if a shared list is pending for import, false otherwise

Page 92 of 168

Page 93: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Static Method

logout(LogoutListener) Logs the user out of Swift Shopper. Your app may wish to display a "Logout" button somewhere after the user logs in. Your app may then call this method when the user clicks the logout button to log the user out of Swift Shopper.

Parameters

Name: Type: Description:

logoutListener

LogoutListener

A listener object that will receive an asynchronous callback when logout fully completes.

Return Value

None, however the given LogoutListener will receive an asynchronous callback when logout fully completes.

Page 93 of 168

Page 94: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Static Method

enterStore(int, EnterStoreListener) Explicitly checks into a specified retailer store for self-scan shopping at that store. If your app is for a retailer who only has one physical retail store location, your app may call this method when the user wishes to start shopping. A shopping session will be created within the Swift Shopper infrastructure for the user to shop at the specified store. Any subsequent activities within your app may then render a com.swiftshopper.sdk.ui.view. SsShopOnTheFlyView to provide the user with the user interface for self-scan shopping. Please also note that the com.swiftshopper.sdk.ui.view.SsListView renders itself in a fashion that is optimized and themed for self-scan shopping from a shopping list. Please also note that the com.swiftshopper.sdk.ui.view.SsDealsView only renders deals at the specified retailer store location until the user completes their shopping session. In addition, the Swift Shopper SDK needs to know which store location the user is shopping at in order to facilitate the shopping experience (look up the store’s pricing for scanned barcodes, submit the final checkout order to the store’s internal point-of-sale system, display current deals at the store, etc.) NOTE: For retailers that have more than one physical shopping location, the app does not call this function. Instead, the app presents a scene with a com.swiftshopper.sdk.ui. view.SsSelectMarketView in the scene’s view hierarchy. The SsSelectMarketView walks the user through the process of selecting a store, officially enters whatever store the user selects, and makes a callback to your app for your app to then present the activity(ies) for the user’s shopping experience. See Also:

● exitStore(OnExitStoreDialogListener)

Parameters

Name: Type: Description:

retailerStoreId

int

The Swift Shopper unique int identifier for the retailer store. Ask your retailer for this int value.

enterStoreListener EnterStoreListener A listener object to receive an asynchronous callback upon success or failure to check the user into the specified store

Page 94 of 168

Page 95: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

for self-scan shopping.

Return Value

None, however the given enterStoreListener object receives an asynchronous callback upon success or failure to check the user into the specified store for self-scan shopping.

Static Method

exitStore(ExitStoreListener) Concludes the user's shopping session and clears the user's shopping shopping cart. After your app allows the app's user to commence self-scan shopping, your app may wish to provide an "Exit Store" icon to allow the user to conclude the user's shopping experience prematurely without purchasing or otherwise completing a checkout. Any such "Exit Store" icon's View.OnClickListener.onClick(View) method would then call this method.

Parameters

Name: Type: Description:

exitStoreListener

ExitStoreListener

A listener object that will receive an asynchronous callback when exiting the store is completed.

Return Value

None, however the given exitStoreListener object receives an asynchronous callback when exiting the store is completed.

Page 95 of 168

Page 96: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Static Method

getStore() Gets the store that the app is currently checked into for self-scan shopping. See also:

● SwiftShopperSdk.enterStore(int, EnterStoreListener)

● com.swiftshopper.sdk.ui.view.SsSelectMarketView

Parameters

None

Return Value

An SsStoreDetail object containing details about the store that the app is currently checked into for self-scan shopping, or null if the app is not currently checked into a store.

Static Method

getUser() Gets information about the user that is currently logged into Swift Shopper.

Parameters

None

Return Value

An SsUser object with information about the user if the user is currently checked into Swift Shopper or null if the user is not currently checked into Swift Shopper. Please be aware the user could be checked in anonymously, in which case an SsUser object will be returned but the SsUser object's isAnonymous() method will return the value true.

Page 96 of 168

Page 97: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Static Method

toggleScannerGuideBar(boolean) Enables or disables the scanner guide bar that appears within Swift Shopper scanner activities. Your app may wish to provide a toggle switch within your app's user interface mechanism for adjusting settings for your app. If so, your app may call this method to subsequently enable or disable the red blinking line that appears on the scanner screens as a hint for a user to line the barcode across the blinking red line. Some people find this blinking red line to be annoying. However, barcodes scan faster if the user lines them up in this section of the screen. Hence, if the user adheres to the hint provided by the blinking red line then barcodes will scan super fast.

Parameters

Name: Type: Description:

toggled

boolean

Pass in true to show the scanner guide bar or false to hide the scanner guide bar.

Return Value

None

Page 97 of 168

Page 98: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

com.swiftshopper.sdk.SsConfig

Purpose Configuration values that the app passes to the SwiftShopperSdk.initialize(SsConfig)

method to initialize the Swift Shopper SDK.

Methods None: Use the com.swiftshopper.sdkSsConfig.Builder class to construct the com.swiftshopper.sdk.SsConfig object that your app passes to the SwiftShopperSdk.initialize(SsConfig) method.

Page 98 of 168

Page 99: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

com.swiftshopper.sdk.SsConfig.Builder

Purpose Constructs a com.swiftshopper.sdk.SsConfig object for the app to pass to the SwiftShopperSdk.initialize(SsConfig) method.

Methods

Constructor

Builder(Context) Instantiates a com.swiftshoper.sdk.SsConfig.Builder object. Example Usage: SwiftShopperSdk.initialize( new SsConfig.Builder()

.setXyz(...)

.setAbc(...)

.build());

Where setXyz(...) and setAbc(...) are one or more of the setter methods that are available on this class.

Parameters

Name: Type: Description:

context

Context

The app’s application context which the app can obtain by calling getApplicationContext() from the app’s custom Application class’s onCreate() method.

Return Value

An SsConfig.Builder object whose setters may be called, followed by calling the build() method to construct an SsConfig object for passing to SwiftShopperSdk. initialize(SsConfig) .

Page 99 of 168

Page 100: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Method

setActivityTheme(@StyleRes int) Sets the Android theme that is applied to all Activities that the Swift Shopper SDK can launch, such as the "Scan Item to Cart" activity, "Please Choose" activity, "Edit List" activity, etc. The font is the most immediately important thing for the app developer to define within the given style. FONT DISCUSSION: The Swift Shopper SDK provides various graphical components that allows apps to include fully implemented & fully functional Swift Shopper features such as shopping lists, deals, and Scan-N-Go checkout within retailer / grocery store / supermarket apps. These graphical components are generally views that are declared within the layout for any of the app's activities or fragments. Some of these views have buttons within them that cause Swift Shopper activities to be displayed. Android automatically applies the activity or fragment's theme to any embedded views within the activity or fragment. Since the app itself provides the activities or fragments that contain the Swift Shopper views, the Swift Shopper views will naturally theme themselves to each such activity or fragments's theme; this includes the font that is rendered within the corresponding Swift Shopper views. These Swift Shopper views launch Swift Shopper activities in some cases, such as when the "checkout" button is pressed from the com.swiftshopper.sdk.ui.view. SsShopOnTheFlyView . Since any such activities launched by Swift Shopper are defined within the Swift Shopper SDK's Android library, any such views do not automatically inherit any theme from the app itself. That is where this method comes into play. The Swift Shopper SDK applies the theme specified in this method to any Swift Shopper activities that are launched in response to the user interacting with Swift Shopper views that are incorporated onto the app's various screens / activities / fragments. IMPORTANT: The theme passed herein needs to inherit from "AppTheme.NoActionBar", here is an example:

<style name="AppTheme.NoActionBar">

Page 100 of 168

Page 101: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

<item name="windowActionBar">false</item>

<item name="windowNoTitle">true</item>

<item name="android:fontFamily">@font/myappfont</item>

</style>

This example assumes that the app has a "font" resource directory under the app's "res" directory in the source code tree. Within the "font" resource directory there is assumed to be a font file whose name is "myappfont" (the extension can be any supported Android font extension such as ".otf" or ".ttf"). The app should then call this method as follows: SsConfig ssConfig = new SsConfig.Builder()

.setActivityTheme(R.style.AppTheme_NoActionBar)

.build();

And then pass the resulting ssConfig object to SwiftShopperSdk.initialize(SsConfig)

Parameters

Name: Type: Description:

activityTheme

@StyleRes int

an integer resource value that refers to an Android theme that the app defines in a "styles" xml resource file. This app should pass something like "R.style.myAppTheme".

Return Value

A reference to the same SsConfig.Builder object thereby allowing calls to the various setter methods followed by the call to the build() method to be chained together in a single Java statement.

Page 101 of 168

Page 102: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Method

setSharedListPath(String) Sets the path for shared list links. For example, a shared list URL might be "http://list.yourapp.com/list/import?listId=1234&shareTypeId=567" in which case the path would be "/list/import". The shared path defaults to "/import" unless the app invokes this method and passes in a specified path. Configuring the shared list path governs the automatic parsing that occurs in the SwiftShopperSdk.importSharedList(...) methods.

Parameters

Name: Type: Description:

sharedListPath String the path for shared list links, such as "/import"

Return Value

A reference to the same SsConfig.Builder object thereby allowing calls to the various setter methods followed by the call to the build() method to be chained together in a single Java statement.

Page 102 of 168

Page 103: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Method

setSharedListIdParam(String) Sets the name of the URL parameter whose value is the "list id" for the list to import as encoded in the URL for shared list links. For example, a shared list URL might be "http://list.yourapp.com/list/import?listId=1234&shareTypeId=567" in which case the name of the URL parameter whose value is the "list id" is "listId". The name of the URL parameter for the "list id" defaults to "listId" unless the app invokes this method and specifies otherwise. Configuring the shared list path governs the automatic parsing that occurs in the SwiftShopperSdk.importSharedList(...) methods.

Parameters

Name: Type: Description:

sharedListIdParam String the name of the URL parameter whose value is the "list id" for the list to import as encoded in the URL for shared list links, such as "listId"

Return Value

A reference to the same SsConfig.Builder object thereby allowing calls to the various setter methods followed by the call to the build() method to be chained together in a single Java statement.

Page 103 of 168

Page 104: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Method

setRetailerSdkKey(String) Sets the retailerSdkKey for the com.swiftshopper.sdkSsConfig object that will be created. Your app is presumably being developed on behalf of a particular Swift Shopper partner SDK retailer. Each such partner retailer is assigned an SDK key. The retailer’s SDK key needs to be provided within the SsConfig that your app passes to SwiftShopperSdk. initialize(SsConfig) . Ask the retailer for this values. The retailer can obtain this value after logging into the Swift Shopper Retailer Portal using the retailer’s credentials.

Parameters

Name: Type: Description:

retailerSdkKey String The retailer’s Swift Shopper SDK key.

Return Value

A reference to the same SsConfig.Builder object thereby allowing calls to the various setter methods followed by the call to the build() method to be chained together in a single Java statement.

Page 104 of 168

Page 105: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Method

setThemeColor(@ColorInt int) The Swift Shopper SDK provides numerous custom views that your app incorporates into your Activity or Fragment layouts. These custom views render themselves to match your app’s general appearance using this color as the theme color. Whereas the activity theme as passed to the setActivityTheme(@StyleRes int) method governs the appearance of activities that the Swift Shopper SDK renders, the theme color governs the appearance of Swift Shopper views that appear within the layout for your app’s activities and/or fragments.

Parameters

Name: Type: Description:

themeColor @ColorRes int

An integer value representing the Android color (not the resource identifier, but rather the int value that packs the individual RGB values, alpha value, etc.)

Return Value

A reference to the same SsConfig.Builder object thereby allowing calls to the various setter methods followed by the call to the build() method to be chained together in a single Java statement.

Page 105 of 168

Page 106: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Method

setSmallLogo(@DrawableRes int) Sets the small logo that the Swift Shopper SDK will render in the center of the navigation bar where appropriate for any full screen views, such as the views that are presented during the in-store checkout process.

Parameters

Name: Type: Description:

logoSmall @DrawableRes int

The resource id for an Android drawable that your app provides as the “small logo”.

Return Value

A reference to the same SsConfig.Builder object thereby allowing calls to the various setter methods followed by the call to the build() method to be chained together in a single Java statement.

Page 106 of 168

Page 107: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Method

setLargeLogo(@DrawableRes int) Sets the optional large logo. If provided, the Swift Shopper SDK will render this image instead of the small logo on any Swift Shopper user interface views when rendering the retailer’s logo, such as on the ‘confirm login’ screen.

Parameters

Name: Type: Description:

logoLarge @DrawableRes int

The resource id for an Android drawable that your app provides as the “large logo”.

Return Value

A reference to the same SsConfig.Builder object thereby allowing calls to the various setter methods followed by the call to the build() method to be chained together in a single Java statement.

Method

build() Creates and returns the com.swiftshopper.sdk.SsConfig object encapsulating the configuration that results after the app has presumably called the various setter methods on this SsConfig.Builder instance.

Parameters

None

Return Value

The com.swiftshopper.sdk.SsConfig object that this SsConfig.Builder builds.

Page 107 of 168

Page 108: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

com.swiftshopper.sdk.SsUser

Purpose Provides information about the user that is currently logged into Swift Shopper. See the SwiftShopperSdk.getUser() method.

Methods

Method

getUserId() Returns a globally unique identifier that identifies the user within the Swift Shopper infrastructure.

Parameters

None

Return Value

String - the globally unique identifier that identifies the user within the Swift Shopper infrastructure.

Method

getUserEmail() Returns the user’s email address if known.

Parameters

None

Return Value

Page 108 of 168

Page 109: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

String - the user’s email address if known otherwise null or empty string.

Method

getUserFirstName() Returns the user’s first name address if known.

Parameters

None

Return Value

String - the user’s first name if known otherwise null or empty string.

Method

getUserLastName() Returns the user’s last name if known.

Parameters

None

Return Value

String - the user’s last name if known otherwise null or empty string.

Page 109 of 168

Page 110: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Method

getUserDisplayName() Returns the user’s preferred display name if known.

Parameters

None

Return Value

String - the user’s preferred display name if known otherwise null or empty string.

Method

getUserPhotoUrl() Returns an http or https URL that can be retrieved via HTTP GET to arrive at the user’s avatar photograph. The photograph’s file format is any photographic image format such as PNG or JPG that is generally valid for display in a web browser HTML image tag.

Parameters

None

Return Value

String - an http or https URL that can be retrieved via HTTP GET to arrive at the user’s avatar photograph. The photograph’s file format is any photographic image format such as PNG or JPG that is generally valid for display in a web browser HTML image tag.

Page 110 of 168

Page 111: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Method

isAnonymous() Indicates whether the user is currently logged in anonymously within the Swift Shopper infrastructure.

Parameters

None

Return Value

boolean - true if the user is logged in anonymously, false if the user is logged in fully

Page 111 of 168

Page 112: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

com.swiftshopper.sdk.SsStoreDetail

Purpose Provides information about the store at which the user is currently shopping. See also:

● The SwiftShopperSdk.getStore() method. ● The SwiftShopperSdk.enterStore() method. ● The com.swiftshopper.sdk.ui.view.SsSelectMarketView class.

Methods

Method

getName() Gets the store’s name for the particular store location.

Parameters

None

Return Value

String - the store’s name for the particular store location.

Page 112 of 168

Page 113: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Method

getStoreId() Gets the unique identifier for the store within the Swift Shopper infrastructure.

Parameters

None

Return Value

int - the unique identifier for the store within the Swift Shopper infrastructure

Method

getLatitude() Gets the latitude component for the store’s location on the globe.

Parameters

None

Return Value

float - the latitude component for the store’s location on the globe

Page 113 of 168

Page 114: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Method

getLongitude() Gets the longitude component for the store’s location on the globe.

Parameters

None

Return Value

float - the longitude component for the store’s location on the globe

Method

hasPosIntegration() Indicates whether the store’s back-end point-of-sale is integrated within the Swift Shopper infrastructure. User in-app purchases are automatically synchronized into the store’s back-end point-of-sale system if the store has point-of-sale integration within the Swift Shopper infrastructure.

Parameters

None

Return Value

boolean - true if the store’s back-end point-of-sale system is integrated within the Swift Shopper infrastructure, false otherwise

Page 114 of 168

Page 115: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Method

isFlyPassEnabled() Indicates whether the store is configured within the Swift Shopper infrastructure as allowing / accepting Swift Shopper FlyPass™ in-app purchases. Swift Shopper FlyPass™ is synonymous with a purchase whereby the user can pay from directly within the app.

Parameters

None

Return Value

boolean - true if the store is configured as allowing / accepting Swift Shopper FlyPass™ in-app purchases, false otherwise

Method

isFlyThruEnabled() Indicates whether the store is configured within the Swift Shopper infrastructure as allowing / accepting Swift Shopper FlyThru™ purchases. Swift Shopper FlyThru™ is synonymous with a purchase whereby the user performs checkout from within the app but completes the payment for the purchase at a checkout counter within the store.

Parameters

None

Return Value

boolean - true if the store is configured as allowing / accepting Swift Shopper FlyThru™ purchases, false otherwise

Page 115 of 168

Page 116: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Method

getWelcomeHtml() Gets the store’s welcome text as configured within the Swift Shopper infrastructure for the particular store location.

Parameters

None

Return Value

String - the store’s welcome text in HTML format as configured within the Swift Shopper infrastructure for the particular store location.

Method

getRetailerName() Gets the name of the store’s retailer. For a retailer with multiple physical store locations, each store location has its own unique store name. However, the retailer’s name is the same for each of the retailer’s multiple stores.

Parameters

None

Return Value

String - the name of the store’s retailer.

Page 116 of 168

Page 117: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

com.swiftshopper.sdk.SsScanResult

Purpose Describes the result of a request to the SwiftShopperSdk.scanItemToCart( SsScanResultListener) method See the SwiftShopperSdk.scanItemToCart(SsScanResultListener) method.

Methods

Method

getMessage() Returns a message that describes the result of the scan. This message is suitable for developer logging.

Parameters

None

Return Value

String - a message that describes the result of the scan. This message is suitable for developer logging.

Page 117 of 168

Page 118: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Method

getRawBarcode() Returns the raw barcode text, which is the entire barcode that was scanned including check digits, etc, if a barcode was successfully scanned otherwise null or empty string.

Parameters

None

Return Value

String - the raw barcode text if a barcode was successfully scanned otherwise null or empty string.

Method

getStatusCode() Returns an SsScanStatusCode enum indicating the result of the scan request. The possible values for SsScanStatusCode are:

● SUCCESS - Indicates that a barcode was successfully scanned. The raw barcode is available via the getRawBarcode() method

● UNKOWN_ERROR - Indicates that an error occurred during the scan. ● NOT_CHECKED_INTO_STORE - Indicates that the user could not be prompted to

scan a barcode due to the app not being currently checked into a store. ● NO_BARCODE_SCANNED - Indicates that the user opted to cancel or otherwise not

scan a barcode.

Parameters

None

Return Value

SsScanStatusCode - a Java enum indicating the result of the scan request.

Page 118 of 168

Page 119: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Appendix 2: Intent Actions for Launching Activities This section describes the custom Android Intent actions that the Swift Shopper SDK supports to start one or more activities or broadcast receivers from your app when certain events occur concerning the user and their Swift Shopper experience. These activities and/or broadcast receivers may then arrange for any pertinent logic to be executed in response to the events that occur.

Intent Actions

Intent Action

ACTION_LOGIN_FOR_PUBLIC_SHARE com.swiftshopper.sdk.LoginForPublicShare

Indicates that the user has requested to “create a link” for one of their shopping lists, however the user is not logged in. The user needs to login to proceed. NOTE: A shared list created via the “Create a Link” menu option within the Swift Shopper Universal shopping app, within a Swift Shopper whitelabel shopping app, or a Swift Shopper partner app via the SDK is internally known as a Swift Shopper “public share”. A user invokes the “create a link” option in order to attain a URL that they may post for example on social media or within a blog. Any user may tap a “public shared” list’s URL to import a copy of the list into their own account. “Public shared” lists are not synchronized. Instead they are used for things like “recipe sharing” whereby a user shares a fixed list perhaps of ingredients that are required for a certain recipe or for a certain type of recurring party event.

Suggested Use

Register an IntentFilter upon your app’s login activity within your app’s AndroidManifest. XML file for this intent action. No further action is needed if your app uses the default functionality that the Swift Shopper SDK provides via the com.swiftshopper.sdk.ui. view.SsLoginView .

Page 119 of 168

Page 120: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Example

AndroidManifest.xml (assuming your app has an activity named LoginActivity): < activity android:name=".LoginActivity" android:label="@string/title_activity_login" android:theme="@style/AppTheme.NoActionBar"> ...

< intent-filter> < action android:name="com.swiftshopper.sdk.LoginForPublicShare"/> < category android:name="android.intent.category.DEFAULT"/> </ intent-filter> ...

</ activity> Broadcast Receiver (in Java code from your app’s custom Application class): public class MyApplication extends Application { ...

private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action;

if (intent != null && (action=intent.getAction()) != null) { switch (action) { case SwiftShopperSdk. ACTION_LOGIN_FOR_PUBLIC_SHARE: // TODO: Do any custom logic in response to the user attempting

// to create public list share, or maybe just launch the

// app’s login activity

Intent intent = new Intent(action); intent.setClass( this, LoginActivity. class); intent.addFlags(Intent. FLAG_ACTIVITY_NEW_TASK); startActivity(intent);

break; ...

}

}

}

};

@Override public void onCreate() { super.onCreate(); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(SwiftShopperSdk. ACTION_LOGIN_FOR_PUBLIC_SHARE); registerReceiver( mBroadcastReceiver, intentFilter); }

@Override public void onTerminate() { unregisterReceiver( mBroadcastReceiver); super.onTerminate(); }

...

}

Page 120 of 168

Page 121: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Intent Action

ACTION_LOGIN_FOR_PRIVATE_SHARE com.swiftshopper.sdk.LoginForPrivateShare

Indicates that the user has requested to “share” one of their shopping lists, however the user is not logged in. The user needs to login to proceed. A “share” button appears on the SsListView when the user is logged in. A “share” button will likewise be displayed If the user is viewing the SsListView but is not logged in or is logged in anonymously, and your app has an activity registered via AndroidManifest.XML with an intent filter for this action. NOTE: A user (User A) invokes the “share” option in order to share their shopping list with a friend or family member (User B). To “share” a list with User B, User A sends a text message or email to User B with a URL for User B to tap on User B’s mobile device to view the shared list. The list is synchronized meaning that anything that one user adds or removes from the list will automatically be reflected in the other user’s rendition of the list as the list appears in both user’s accounts.

Suggested Use

Same suggested usage as documented for ACTION_LOGIN_FOR_PUBLIC_SHARE but for ACTION_LOGIN_FOR_PRIVATE_SHARE.

Example

See example for ACTION_LOGIN_FOR_PUBLIC_SHARE. Everything is the same but for ACTION_LOGIN_FOR_PRIVATE_SHARE (“com.swiftshopper.sdk.LoginForPrivateShare”) instead of ACTION_LOGIN_FOR_PUBLIC_SHARE (“com.swiftshopper.sdk.LoginForPublicShare”).

Page 121 of 168

Page 122: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Intent Action

ACTION_LOGIN_TO_VIEW_SHARED_LIST com.swiftshopper.sdk.LoginToViewSharedList

Indicates that a user (User B) has tapped a shared list URL / link in an external app such as an SMS / text messaging or email app to access another user’s (User A’s) shared list but the user (User B) is not logged into Swift Shopper. Details The Swift Shopper SDK uses this intent action to start the 3rd party app's login activity if a user (User B) tries to view a shopping list that another user (User A) invited the user (User B) to view when the user (User B) is not logged into Swift Shopper. To take advantage of this functionality, the app should declare its Login Activity within the app's AndroidManifest.xml with an intent-filter whose action name matches the constant string value.

Value: com.swiftshopper.sdk.LoginToViewSharedList Sequence of Events

● A user (User A) shares his/her shopping list with another user (User B) ● User B receives a text message with a link/URL to click to view User A's shopping list ● User B taps the link/URL from his/her text message, however, User B has never

logged into Swift Shopper from your app ● Your app is started on User B's device and the app automatically navigates to the

app's shopping list activity (since your app hypothetical follows the instructions in this document for integrating the Swift Shopper shared list feature). Your app’s shopping list activity which displays a com.swiftshopper.sdk.ui. view.SsListView view component.

● The com.swiftshopper.sdk.ui.view.SsListView detects that User A's list needs to be imported into User B's account but User B is not logged into Swift Shopper

● The com.swiftshopper.sdk.ui.view.SsListView starts your app's activity that is registered with an intent filter for this value. Your app's login activity is registered with the intent filter for this value

● Your app's login activity starts via this intent action.

Page 122 of 168

Page 123: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

● Your app's login activity either (a) displays an SsLoginView or implements a custom login flow

● The user logs into Swift Shopper via your app's login activity. ● Your login activity closes / finishes itself just after the user completes the log in ● Android naturally returns back to the previous activity which displays the

com.swiftshopper.sdk.ui.view.SsListView . ● The com.swiftshopper.sdk.ui.view.SsListView proceeds to import the

shared list into User B’s account and displays the shopping list since the user is fully logged in.

Suggested Use

Register an IntentFilter upon your app’s login activity within your app’s AndroidManifest. XML file for this intent action. No further action is needed if your app uses the default functionality that the Swift Shopper SDK provides via the com.swiftshopper.sdk.ui. view.SsLoginView . However, call be sure to call finish() from your app’s login activity after the user logs in particularly if your login activity was started via this intent. Android will then naturally return your app back to the previous activity, which is the activity that was first launched when the user tapped the URL / link to view the shared list. Per the instructions in the document this activity is your app’s shopping list activity that displays an SsListView . The SsListView detects that the user is fully logged in and that there is an outstanding attempt to view a publicly shared list. As a result, the SsListView proceeds to import the shared list into the user’s account and displays the shared list.

Example

AndroidManifest.xml (assuming your app has an activity named LoginActivity): < activity android:name=".LoginActivity" android:label="@string/title_activity_login" android:theme="@style/AppTheme.NoActionBar"> ...

< intent-filter> < action android:name="com.swiftshopper.sdk.LoginToViewSharedList"/> < category android:name="android.intent.category.DEFAULT"/> </ intent-filter> ...

</ activity>

Page 123 of 168

Page 124: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Intent Action

ACTION_CHECKOUT_COMPLETE Indicates that the user has just completed self-scan checkout via Swift Shopper FlyPass™ or Swift Shopper FlyThru™.

Suggested Use

Your AndroidManifest.xml file should declare an intent-filter for this intent action upon your app’s main / home activity. This will result in the user being navigated back to “home” after the user completes their self-scan checkout. Programmatically register a broadcast receiver from your app’s class that extends android.app.Application with an intent filter for action SwiftShopperSdk. ACTION_CHECKOUT_COMPLETE . Do this registration from your application class’s onCreate() method. Unregister the broadcast receiver from your application class’s onTerminate() method. Code the broadcast receiver’s onReceive method to start your app’s main / home activity with intent flag FLAG_ACTIVITY_NEW_TASK . This will navigate the user to your app’s main / home activity after the user completes self-scan checkout and ensure that the user cannot navigate “back” into the shopping experience. Furthermore, it is suggested that your application class’s onCreate method be used to launch the initial activity when the user launches your app. The suggested logic evaluates whether the app is currently checked into a store. If so, launch your app’s self-scan shopping activity. Otherwise launch your app’s main /home activity

Example

public class AnyNameApplication extends Application {

public BroadcastReceiver mSwiftShopperBroadCastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Intent mainActivityIntent = new Intent(getApplicationContext(), MainActivity.class); mainActivityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(mainActivityIntent);

}

};

public void onCreate() { super.onCreate(); SwiftShopperSdk.initialize (new SsConfig.Builder(this) .setRetailerSdkKey(...) .setSmallLogo(R.mipmap.ic_...) .setLargeLogo(R.mipmap.ic_...)

Page 124 of 168

Page 125: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

.setActivityTheme(R.style.AppTheme_NoActionBar ) .setThemeColor(ResourcesCompat.getColor( getResources(), R.color.colorPrimary, null)) .build());

IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(SwiftShopperSdk.ACTION_CHECKOUT_COMPLETE); registerReceiver(mSwiftShopperBroadCastReceiver, intentFilter);

Intent startingActivity;

if (SwiftShopperSdk.getStore() == null) { startingActivity = new Intent(getApplicationContext(), MainActivity.class); } else { startingActivity = new Intent(getApplicationContext(), ShopListDealsActivity.class); }

startingActivity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(startingActivity);

}

@Override public void onTerminate() { unregisterReceiver(mSwiftShopperBroadCastReceiver); super.onTerminate(); }

}

Intent Action

ACTION_SHARE_LIST_AFTER_LOGIN com.swiftshopper.sdk.ShareListAfterLogin

The Swift Shopper SDK uses this intent action to return to the 3rd party app's shopping list activity after a user (User A) tries to share his/her list yet is not logged in. When a user (User A) tries to share his/her shopping list but is not logged in, the Swift Shopper SDK uses ACTION_LOGIN_FOR_PRIVATE_SHARE and attempts to navigate to the app's login activity. After the user (User A) logs in, the Swift Shopper SDK uses this action (ACTION_SHARE_LIST_AFTER_LOGIN ) to attempt to navigate the user back to the app's shopping list activity whereby the com.swiftshopper.sdk.ui.view.SsListView displayed therein proceeds to walk the user through the process of sharing his/her shopping list.

Suggested Use

The app should declare its Shopping List Activity within the app's AndroidManifest.xml with an intent-filter whose action name matches this particular constant's string value.

Page 125 of 168

Page 126: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Example

<activity android:name=".ShoppingListActivity" android:label="@string/title_activity_shopping_list" android:launchMode="singleTask" android:theme="@style/AppTheme.NoActionBar"> <!-- list.swiftshopper.com intent filter--> <intent-filter android:label="@string/another_sdk_sample_view_list"> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> <data android:scheme="http" android:host="list.swiftshopper.com" android:pathPrefix="/import"/> </intent-filter> <intent-filter android:label="@string/another_sdk_sample_view_list"> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> <data android:scheme="sslistshare"/> </intent-filter>

<!-- sslistshare intent filter --> <intent-filter android:label="@string/another_sdk_sample_view_list"> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> <data android:scheme="sslistshare"/> </intent-filter>

<!-- com.swiftshopper.sdk.ShareListAfterLogin intent filter --> <intent-filter> <action android:name="com.swiftshopper.sdk.ShareListAfterLogin"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity>

Page 126 of 168

Page 127: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Appendix 3: Swift Shopper Views The Swift Shopper SDK provides the following views that your app may include within any of your app’s activity’s and/or fragment’s layout. These views color themselves by default in accordance with the color that your app passes to the SwiftShopperSdk.initialize(...) method. In addition, you may generally set the background color for the for these views either programmatically or via layout.xml attribute. You may explicitly define other graphical aspects on a case-by-case basis depending on the view class. These views renders static text and dynamic content. You may customize the static text via the by overriding various string resources from the Swift Shopper SDK within your app’s string resource XML file(s). String customization is discussed in Appendix 5.

Views

View

com.swiftshopper.sdk.ui.view.SsCartView Displays the contents of the user’s shopping cart. Also provides a checkout button that the user may tap to initiate the checkout process. Depending on the retailer’s configuration within Swift Shopper, the user may purchase from within the app and/or have a code rendered on their device’s screen that they can present to a cashier or scan off of their device’s screen at a self-checkout kiosk that is located in the store in order to pay for their goods at the store.

Suggestions

Use this in conjunction with the SsCartButtonView . Present the SsCartButtonView on activities and/or fragments that your app presents while the user is shopping. Present the SsCartView or an activity / fragment that includes the SsCartView when the SsCartButtonView is tapped.

Page 127 of 168

Page 128: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

View

com.swiftshoper.sdk.ui.view.SsCartButtonView A button-sized view that illustrates the number of items in the user’s shopping cart along with a cart icon.

Suggestions

Render an SsCartButtonView perhaps in the upper right-hand corner of your app’s action bar / toolbar when the user is shopping. Use this in conjunction with the SsCartView . Present the SsCartView or an activity / fragment that includes the SsCartView when the SsCartButtonView is tapped.

Further Customization

By virtue of being a view, the cart button view’s background can be defined in the layout editor or programmatically in your Java source code. Android will essentially treat the background as transparent if you do not explicitly define a background, thereby using the background from any view that your layout may have located just behind the cart button view. The cart button view will render the cart icon and the text that indicates the number of items that are in the user’s shopping cart both using the color white by default. Your app may customize this behavior by defining an app:cartButtonForegroundColor for the cart button view within the corresponding layout XML file, or by calling the cart button view’s setCartButtonForegroundColor(@ColorInt int) method from Java source. Explicitly setting the backgroundColor is no different than setting the background color for any Android view.

Properties

You may set these properties programmatically or via the XCode interface builder using the Identity Inspector’s “User Defined Runtime Attributes” section.

Name: Type: Description:

app:

cartButtonForegroundColor Color Defines the color for the cart icon and the text that the

SsCartButtonView renders. Unless specified, this defaults to white.

Page 128 of 168

Page 129: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

View

com.swiftshopper.sdk.ui.view.SsOrderHistoryView Displays a list of the user’s past in-app purchases that occurred at any of the retailer’s stores. The user may view a copy of their receipt for any of their past purchases. The user may download, email, or print the receipt via the ‘Share’ button that is rendered on the screen while the user is viewing a receipt for a past purchase.

Suggestions

Create an activity or fragment for viewing order history. Fill the activity or fragment’s real estate minus navigation with an SsOrderHistoryView . Assuming that your app presents some sort of options menu, or perhaps a menu that appears after tapping a “hamburger” / menu / settings icon, include an option for the user to view their order history. Navigate the user to this activity or fragment when the user chooses to view their order history.

Page 129 of 168

Page 130: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

View

com.swiftshopper.sdk.ui.view.SsShopOnTheFlyView Displays a self-scan shopping experience that allows the user to scan products off of the shelves at the store in which the user is currently shopping. Prior to displaying an SsShopOnTheFlyView , your app must somehow have the user enter a store. If your app is for a retailer with exactly and only one store location, your app would need to call SwiftShopperSdk.enterStore(int) just prior to displaying an SsShopOnTheFlyView . If your app is for a retailer with multiple store locations, your app would need to present an SsSelectMarketView . The user would then need to select and check into a nearby store. Your app would then receive a callback after the user enters a store and present the SsShopOnTheFlyView thereafter.

Suggestions

Create an activity or fragment for simple self-scan shopping at the store. Fill most of the real estate minus navigation with an SsShopOnTheFlyView . Consider customizing the ‘back’ button that your app presumably provides via the action bar / toolbar to become an exit (“X”) button. The idea is to help keep the user inside of your app’s shopping experience until the user explicitly chooses to exit the store or until the user completes their purchase. Consider prompting the user for confirmation if they click the exit button, warning the user that any items in their cart will be lost. Consider displaying an SsCartButtonView in the upper right-hand corner within the action bar / toolbar that your app presumably provides. See the SsCartButtonView reference for details. Consider registering your app’s main / home activity in your AndroidManifest.XML with an IntentFilter for the SwiftShopperSdk.ACTION_CHECKOUT_COMPLETE intent action (“com.swiftshopper.sdk.CheckoutComplete”) and with activity flag “single top” to navigate the user to the opening screen of your app (presumably a main / home activity that provides the user with options such as “Shop”, “View Retailer Info”, “View Weekly Specials”, “View Upcoming Events”, etc. when the user finishes shopping. If you’d rather not flag the main / home activity as “single top” then reset the navigation stack so that the user can not navigate back into the shopping experience after completing the purchase or exiting the store. (It would not make sense to allow the user to navigate back. Of course the user may re-enter the store, or view their order history if your app integrates order history. See the ACTION_CHECKOUT_COMPLETE intent action reference for details.

Page 130 of 168

Page 131: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

View

com.swiftshopper.sdk.ui.view.SsProfileView Displays the user’s Swift Shopper profile illustrating the user’s name, photo, number of items ever scanned, and the total number of checkouts ever completed via Swift Shopper.

Suggestions

Create an activity or fragment for the user to view their profile. Fill the corresponding real estate minus navigation with an SsProfileView. Assuming that your app presents some sort of options menu, or perhaps a menu that appears after tapping a “hamburger” / settings / menu icon, include an option for the user to view their profile. Navigate the user to this activity or fragment when the user chooses to view their profile. Consider including a “logout” mechanism (Button, etc) on the activity or fragment’s action bar / toolbar that invokes SwiftShopperSdk.logout(LogoutListener) when invoked if the user is not currently shopping at a store. Alternately, some apps display an icon of the user’s photograph in the corner of the screen perhaps via the action bar / toolbar after the user logs in. If your app exhibits this behavior, your app may display the activity / fragment that includes the SsProfileView when the user taps the icon of the user’s photograph. Your app may find the user’s photograph by calling SwiftShopperSdk.getUser().getUserPhotoUrl(). The following example source code draws the user’s photograph as the view for a MenuItem that corresponds to an icon on an activity’s action bar / toolbar. This hypothetical code is presumably declared on the app’s main activity’s java file: @Override

public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu. main_menu, menu);

MenuItem loginItem = menu.findItem(R.id. action_login); SsUser ssUser = SwiftShopperSdk. getUser(); String ssUserPhotoUrl = (ssUser == null) ? null : ssUser.getUserPhotoUrl(); ssUserPhotoUrl = (ssUserPhotoUrl == null) ? null : ssUserPhotoUrl.trim(); if (ssUserPhotoUrl != null && ssUserPhotoUrl.length() > 0 ) { Glide. with( this).load(ssUserPhotoUrl).asBitmap() .fitCenter().atMost().into( new SimpleTarget<Bitmap>( 96 , 96 ) { @Override public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { loginItem .setIcon( new BitmapDrawable(getResources(), resource)); }

});

}

return true; }

Page 131 of 168

Page 132: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

View

com.swiftshopper.sdk.ui.view.SsLoginView Presents login buttons for social media login and walks the user through social media login.

Suggestions / Usage

Assuming that your app does not need to log users in via a user account that the retailer themselves might use, and assuming that neither you, your organization, nor the retailer wishes to maintain the accounts for your app’s users, simply create an activity or fragment for login. Fill the corresponding real estate with an SsLoginView. From the java source code for the activity or fragment, update the activity or fragment’s class definition and state that the activity or fragment implements the SsLoginView.Delegate interface. Define the following methods to implement the SsLoginView.Delegate interface:

● proceedAnonymously(Runnable) -- this method is called when the user presses the ‘Skip’ login button. Your app may present a confirmation dialog asking the user if they are sure that they wish to skip login (possibly warning the user that by skipping the login they will not be able to use the shared list feature and their purchase receipts will not be emailed to them). Upon confirmation, show a loading animation and call the run() method on the Runnable object that is passed to this same proceedAnonymously(Runnable) method. The Runnable ’s run() method proceeds to log the user in anonymously as a result of the user electing to skip login.

● onLoginSuccess() -- this method is called immediately upon login success after the logs in via social media and/or after anonymous (“Skip”) login. Dismiss the loading animation that your app may have displayed from the proceedAnonymously(Runnable) method and have the activity call finish() on itself or otherwise navigate the user back to where you would like for the user to be navigated after successful login.

● onLoginFailure() -- this method is called immediately upon failed login attempt, for example if the internet intermittently drops out. Dismiss the loading animation that your app may have displayed from the proceedAnonymously(Runnable) method and display a toast, present snackbar text, etc to notify the user of the login failure and possibly suggest that the user try again.

Make the activity or fragment’s Java source get a reference to the SsLoginView from the activity or fragment’s layout, perhaps by overriding the activity or fragment’s onCreate(...) method. Call the setLoginDelegate(SsLoginView.Delegate) method and pass in the reference (for example, the Java ‘this ’ reference) for the activity or fragment that now implements the SsLoginView.Delegate interface.

Page 132 of 168

Page 133: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Consider whether your app supports importing shared lists. A user must fully login in order to import a shared list. If your app supports importing shared lists, and a non-logged in user attempts to access a shared list, seamlessly walk the user through the login process. See SwiftShopperSdk.ACTION_LOGIN_TO_VIEW_SHARED_LIST for details. Update the onLoginSuccess() method to navigate the user to the activity or fragment that renders the SsListView if your login activity was started via an Android Intent whose intent action is SwiftShopperSdk.ACTION_LOGIN_TO_VIEW_SHARED_LIST .

Further Customization

By default the user is presented with all Swift Shopper supported login mechanism as well as the option to skip login. The user is logged in anonymously if the user opts to skip login. The “Skip Login” option is rendered in white, black, or in the theme color specified in the SwiftShopperSdk.initialize(SsConfig) : the SsLoginView attempts to analyze the background that you define behind the SsLoginView and then choose the best foreground color accordingly. You may customize all of this behavior by specifying one or more of the following attributes to remove one or more login options or to explicitly set the color in which to render the “Skip Login” option.

Properties

You may set these properties in your app’s layout.xml file(s) that declare the SsLoginView or programmatically via Java setter methods upon the SsLoginView object or via the XCode interface builder using the Identity Inspector’s “User Defined Runtime Attributes” section.

Name / Key Path: Type Description:

app: allowSkipLogin

Boolean Specifies whether to render the option for the user to skip login (which results in the user being logged in anonymously). The default value is true unless specified otherwise.

app: allowGoogleLogin

Boolean Specifies whether to render the option for the user to login via Google. The default value is true unless specified otherwise.

app: allowFacebookLogin

Boolean Specifies whether to render the option for the user to login via Facebook. The default value is true unless specified otherwise.

app: allowTwitterLogin

Boolean Specifies whether to render the option for the user to login via Twitter. The default value is true unless specified otherwise.

Page 133 of 168

Page 134: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

app: skipButtonForegroundColor

Color Explicitly specifies the color in which to render the “Skip Login” option.

View

com.swiftshopper.sdk.ui.view.SsSelectMarketView Displays a list of nearby retail store locations prompting the user to choose a location to shop at.

Suggestions

Create an activity or fragment that fills most of its real estate with an SsSelectMarket view if your app’s retailer has more than one physical store location. Your app will not need to use the SsSelectMarketView if your app’s retailer has exactly and only one physical store location. Get a reference to the SsSelectMarketView from the activity or fragment’s Java source and call the SsSelectMarketView’s setCheckInListener(SsSelectMarketView.CheckInListener) method. The SsSelectMarketView.CheckInListener interface consists of exactly one method named onCheckInComplete() that takes no parameters. Pass in either a Java lamba or anonymous inner class whose implementation for the one and only method for the SsSelectMarketView.CheckInListener interface navigates the user to your app’s activity or fragment that displays the SsShopOnTheFly view. Provide a means on your app’s main / home activity that your user would invoke to start shopping. When invoked, your app should check if the user is currently checked into a retail store [see the SwiftShopperSdk.getStore() method]. If the user is not currently checked into a retail store, navigate the user to your app’s activity / fragment that includes the SsSelectMarketView . The user will then be prompted to select a nearby store. The user will then be navigated to your app’s shopping activity / fragment per the previous paragraph’s suggestion. If the user is already checked into a retail store, navigate the user directly to your app’s shopping activity / fragment that displays the SsShopOnTheFlyView .

Page 134 of 168

Page 135: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

View

com.swiftshopper.sdk.ui.view.SsListView Displays the contents of the user’s current shopping list. Allows the user to add new shopping lists. Allows the user to change the current shopping list to a different shopping list. Allows the user to view and edit the items in the current shopping list. Indicates whether the retailer has any deals for items in the current shopping list. Allows the user to view the deals for any items in their shopping list. Allows the user to delete any of their shopping lists. Allows a fully logged in user to share their shopping list with another user. Allows a fully logged in user to view or edit a shared list. The SsListView customizes the user experience based on whether the user is currently checked into a store. Allows the user to scan items from their shopping list into their shopping cart if the user is checked into a store. Allows the user to scan an item in general to their shopping cart if the user is checked into a store. The SsListView allows the user to scan items to their shopping list if the user is not currently checked into a store. The idea is that the user is probably at their house and scanning items that they have around the house into their shopping list as a reminder to themselves to purchase the items the next time that they go shopping at one of the retailer’s stores.

Suggestions

Create an activity or fragment that includes an SsListView that fills most of the real estate. Consider whether to allow your users to shop from their shopping lists. If so, provide a means from your app’s shopping activity / fragment (your app’s activity/fragment that includes the SsShopOnTheFlyView ) to navigate to the shopping list activity / fragment that includes the SsListView . Also consider providing a means for the user to navigate from the shopping list activity / fragment to the regular shopping activity / fragment displaying the SsShopOnTheFlyView but only reveal this mechanism (programmatically) if the user is currently checked into a store. Customize the Java source for the activity / fragment that displays the SsListView . Check if the user is currently checked into a store from within the activity / fragment’s onCreate(...) method. Set the screen’s title to indicate whether the user is shopping from their list or just viewing / editing their list. Add an SsCartButtonView to the upper right in the action bar / toolbar if the user is currently checked into a store. Reveal any navigation mechanism that your shopping list activity / fragment may provide in order for the user to navigate to the ordinary shopping scene that includes the SsShopOnTheFlyView if the user

Page 135 of 168

Page 136: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

is checked into a store. Navigate the user to the SsCartView when the user taps the SsCartButtonView . Consider optimizing for tablet devices by rendering the SsListView and the SsShopOnTheFlyView from within the same activity, perhaps having one of the views located in a fragment on the top / left while having the other view located in a fragment on the bottom / right.

View

com.swiftshopper.sdk.ui.views.SsDealsView Displays the current weekly deals at all nearby stores for the retailer if the user is not checked into a particular store. Displays the current weekly deals at the current store if the user is checked into a store. The user may add a deal to the user’s shopping list if the user is not checked into a store. The user may scan a deal into the user’s shopping cart if the user is checked into a store.

Suggestions

Create an activity / fragment that includes an SsDealsView in the activity or fragment’s layout that fills most of the real-estate with the SsDealsView . Provide a user interface mechanism for the user to invoke to view deals. Navigate the user to this activity / fragment when the user invokes the user interface mechanism to view deals. Assuming that your app allows the user to view deals both when they are checked into a store and even when they are not checked into a store, consider programmatically adding an SsCartButtonView to the upper right perhaps via the action bar / toolbar if the user is checked into a store; then navigate to the activity / scene within your app that displays an SsCartView when the user taps the SsCartButtonView .

Page 136 of 168

Page 137: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Appendix 4: Listener Interfaces The Swift Shopper SDK provides various user interface views that your app may incorporate into the layout on the various activities and/or fragments within the app. iOS allows you to define and associate one view controller class per scene. You may obtain references to these views in your activities and/or fragments’ Java code via the standard android findViewById(int) and/or binding mechanism. Some of the Swift Shopper view classes support a listener interface whereby an activity or fragment having a Java reference to the view can assign itself or another object as a listener to receive specific callbacks or plug-in custom functionality when certain milestones occur at runtime as the user interacts with the view. The available Java interfaces for these listeners are defined here-in for reference.

Page 137 of 168

Page 138: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Interface

SsSelectMarketView.CheckinListener Receives a callback immediately after a user selects and checks into a retail store for in-store shopping.

Provided By

com.swiftshopper.sdk.ui.view.SsSelectMarketView

Required Method

onCheckInComplete This is a callback method that is called immediately after a user selects and checks into a retail store for in-store shopping.

Parameters

None, however, you may call the SwiftShopperSdk.getStore() method to get the com.swiftshopper.sdk.SsStoreDetails object that describes the store that the user checks into.

Page 138 of 168

Page 139: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Interface

SsListView.ShareListDelegate Provides a custom implementation for a user to share a shopping list with another user.

Provided By

com.swiftshopper.sdk.ui.view.SsListView

Required Method

shareList(int, int) This is a callback method that is called when the user presses the “share” button on a shopping list that they are viewing via the SsListView. The custom logic that is provided needs to take the given listId and type and somehow deliver these to another user’s running instance of your app. The other user’s running instance of your app needs to ultimately pass these values to the SwiftShopperSdk. importSharedList(int, int) method (Android) or SwiftShopperSdkFramework. importSharedList(String, String) function (iOS) to import the first user’s list into the second user’s account. Any SsListView (Android) or SSListView (iOS) objects will then display the first user’s list in the second user’s app. Moreover the list will be synchronized between the two users. Any changes that one user makes to the list will be automatically reflected in the second user’s SsListView and vice-versa. The suggested implementation is to generate a text message or email with an HTTP(S) link that encodes an obfuscated rendition of the listId and type, including some verbiage such as “Hey, click here to check out my list!”, then prompt the user to send this text message or email to the second user. The second user will tap the link to see the first user’s list. The second user’s web browser opens when they tap the link. The web page asks the user to click the link from an iOS or Android device if the second user’s web browser is not running on an iOS or Android device. The web page may offer to text the link to the second user if the second user wishes to enter their mobile phone number onto the web page. Ultimately the second user taps the link on an iOS or Android device. If the link adheres to iOS Universal Link standards and Android App Link standards, iOS and Android will either open the app and pass the link to the app if the app is installed or navigate the user to the App Store to download the app if the app is not installed. iOS and/or Android then

Page 139 of 168

Page 140: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

automatically passes the link into the app after the user installs the app and subsequently runs the app for the first time. To support an Android App Link your app will register an IntentReceiver upon an Activity via your app’s AndroidManifest.XML file in accordance with Android App Link standards. Android will launch your app as necessary, start the specified activity, and set the activity’s intent to an intent that encodes the URL for Android App Link. The logic in your activity’s onResume or onStart method extracts the URL for the App link, then extracts or resolves the list id and share type id from the Android App Link URL, and passes these to the SwiftShopperSdk.importList(int, int) method. The corresponding list will be imported and synchronized into the second user’s account and appear the very next time that your app displays an SsListView. The SwiftShopperSdk.importList(...) methods throw the checked com. swiftshopper.sdk.SwiftShopperSdk.LoginStateException if the second user is not fully logged into Swift Shopper. You should catch this exception, inform the user that they need to log in in order to access the shared list, and navigate the user to your app’s login activity. Your app’s login activity should implement SsLoginView.Delegate , associates itself to its SsListView , and receive the onLoginSuccess() callback. Navigate the user to your app’s activity or fragment that displays an SsListView if the user is logged in fully (non-anonymously) and if the SwiftShopperSdk. hasPendingSharedListForImport() method returns true. The Swift Shopper SDK will import the list into the user’s account and display the list in the SsListView . NOTE: There are third-party services such as “Branch IO” that provide much of the iOS Universal / Android App Link functionality for free.

Parameters

Name: Type: Description:

listId int Uniquely identifies the user’s list as a shared list within the Swift Shopper infrastructure. As described above, this value needs to be ultimately passed into the SwiftShopperSdk. importSharedList(...) method (Android) or SwiftShopperFramework.

importSharedList(...) function (iOS) in the other user’s running instance of your app provided that the other user is logged in fully to Swift Shopper.

type int An object that represents the type of shared list.

Page 140 of 168

Page 141: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

As described above, this value needs to be ultimately passed into the SwiftShopperSdk. importSharedList(...) method (Android) or SwiftShopperFramework.importSharedList(...) function (iOS) as the “shareType” parameter value in the other user’s running instance of your app provided that the other user is logged in fully to Swift Shopper.

Page 141 of 168

Page 142: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Interface

SsLoginView.Delegate Provides callbacks that permit an activity, fragment, etc. displaying an SsListView to receive callbacks when the user logs in, attempts to log in anonymously, or a failure occurs during login. The activity / fragment can then close itself, navigate the user to the app’s main / home activity, navigate the user to the app’s activity / fragment that displays the SsListView, etc, as appropriate based on why / how the activity / fragment displaying the SsLoginView was started.

Provided By

com.swiftshopper.sdk.ui.view.SsLoginView

Required Method

onLoginSuccess() This is a callback method that is called immediately after the user logs in either via full, social media login or anonymously via the “Skip Login” option.

Parameters

None, however you may call SwiftShopperSdk.getUser() to get the user’s information and/or to determine whether the user elected to login anonymously (aka: “Skip” login).

Required Method

onLoginFailure(Throwable) This is a callback method that is called if the user attempts to login either via social media login or anonymous (aka: “Skip” login) if an error occurs when the Swift Shopper SDK attempts to process the login, such as an intermittent internet connectivity issue on the user’s devices.

Parameters

Name: Type: Description:

Page 142 of 168

Page 143: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

throwable Throwable The upstream throwable that caused the login failure. This object is potentially useful for developer logging and/or debugging.

Required Method

proceedAnonymously(Runnable) This is a callback method that is called if the user taps the “Skip Login” button. Your app’s activity / fragment which presumably implements this interface and presents the SsLoginView can decide whether to allow anonymous login to proceed. This callback method is called after the user presses the 'Skip Login' button. You will need to run the Runnable that is passed to this method in order to allow anonymous login to proceed. For example, you may implement this method by prompting the user if they are sure, explaining the benefits of logging in (shared list access, email receipts upon checkout). If the user still opts not to login, then call the run() method on the given Runnable .

Parameters

Name: Type: Description:

runMeToProceed Runnable The delegate object can run this object if the delegate object wishes to the anonymous login to proceed. Otherwise, the user will simply still be viewing the delegate's activity / fragment and its SsLoginView .

Page 143 of 168

Page 144: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Interface

SsScanResultListener Receives a callback immediately after a user selects and checks into a retail store for in-store shopping.

Provided By

com.swiftshopper.sdk.SsScanResultListener

Required Method

onScanResult(SsScanResult) This is a callback method that is called to provide the result of a call to any rendition of the SwiftShopperSdk.scanItemToCart(...) method.

Parameters

Name: Type: Description:

ssScanResult SsScanResult The result of the attempt to prompt the user to scan an item into the user’s shopping cart. See the class reference for the com.swiftshopper.sdk.SsScanResult class for details.

Page 144 of 168

Page 145: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Interface

LoginListener Receives an asynchronous callback that indicates the result of a call to any rendition of SwiftShopperSdk.login(...) or SwiftShopperSdk.loginAnonymous(...) .

Provided By

com.swiftshopper.sdk.login.LoginListener

Required Method

onLoginSuccess() This is a callback method that is asynchronously called to indicate a successful result for a call to SwiftShopperSdk.login(...) or SwiftShopperSdk.loginAnonymous(...)

Parameters

None, however the SwiftShopperSdk.getUser() method may be called to access details about the user and details about the login.

Required Method

onLoginFailure(Throwable) This is a callback method that is called if an error occurs when the Swift Shopper SDK attempts to asynchronously process the login, such as an intermittent internet connectivity issue on the user’s devices.

Parameters

Name: Type: Description:

throwable Throwable The upstream throwable that caused the login failure. This object is potentially useful for developer logging and/or debugging.

Page 145 of 168

Page 146: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Interface

LogoutListener Receives an asynchronous callback that indicates asynchronous completion following a call to SwiftShopperSdk.logout(LogoutListener) .

Provided By

com.swiftshopper.sdk.SwiftShopperSdk.LogoutListener

Required Method

onLogout() This is a callback method that is asynchronously called to indicate a completed result following a call to SwiftShopperSdk.logout(LogoutListener) .

Parameters

None

Page 146 of 168

Page 147: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Interface

EnterStoreListener Receives an asynchronous callback that indicates the result of a call to SwiftShopperSdk.enterStore(int, EnterStoreListener) .

Provided By

com.swiftshopper.sdk.SwiftShopperSdk.EnterStoreListener

Required Method

onSuccess() This is a callback method that is asynchronously called to indicate a successful result for a call to SwiftShopperSdk.enterStore(int, EnterStoreListener) .

Parameters

None, however the SwiftShopperSdk.getStore() method may be called to access details about the store that has been successfully entered.

Required Method

onFailure() This is a callback method that is called if an error occurs when the Swift Shopper SDK attempts to asynchronously enter a specified via the SwiftShopperSdk.enterStore( int, EnterStoreListener) method.

Parameters

None.

Page 147 of 168

Page 148: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Interface

ExitStoreListener Receives an asynchronous callback that indicates completion following a call to SwiftShopperSdk.exitStore() .

Provided By

com.swiftshopper.sdk.SwiftShopperSdk.ExitStoreListener

Required Method

onExitStore() This is a callback method that is asynchronously called to indicate asynchronous completion following a call to SwiftShopperSdk.exitStore(ExitStoreListener) .

Parameters

None

Page 148 of 168

Page 149: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Appendix 5: String Customizations The various Swift Shopper view objects display static text and dynamic content. Swift Shopper utilizes Android standard string resource mechanism. As such, your app may redefine any such string to replace the default text with your own. Simply define any of the string resources documented in this appendix in any of your app’s strings xml resource files. TIP: In some instances the static strings are rendered in a fixed amount of on-screen real estate and may not necessarily accommodate arbitrary lengths of custom text. Please run your app and verify that any string customizations render sensibly on the corresponding user interface screen(s) or control(s) and moderately adjust any custom verbiage accordingly. TIP: To support multiple languages your app may define these strings in any language subset in accordance with Android string localization which Android supports for all Android apps.

Available Strings for Customization The following is a list of all available string customizations as of this document’s date. The value on the left of each equals sign (=) is the “key” (the left side of the mapping) that you would place in your string to string mapping. <string name="app_name">SwiftShopperSdk</string> <string name="txt_label_please_wait">Please wait!</string> <string name="no_checkout_configuration_for_store">Checkout misconfigured for this store. Please contact technical support</string> <string name="default_label">Default</string> <string name="alphabetically">Alphabetically</string> <string name="category">Category</string> <string name="aisle_number">Aisle Number</string> <string name="msg_item_added_successfully_1">%s added to list</string> <string name="msg_item_update_successfully">Item updated successfully from list</string> <string name="location_rationale_plan">Location is needed to find nearby deals for items in your shopping list.</string> <string name="btn_cancel">Cancel</string> <string name="btn_settings">Settings</string> <string name="location_is_currently_disabled">Location is currently disabled</string> <string name="please_enable_access_to_location">Please enable access to Location from Settings.</string>

Page 149 of 168

Page 150: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

<string name="settings_title">Settings</string> <string name="warning_description">Age restricted items can not be scanned or purchased with this app.\n\nPlease place age restricted items aside in your shopping cart and purchase them at the checkout counter.</string> <string name="warning_age_restricted_item">WARNING: Age Restricted Item</string> <string name="age_restricted_item">AGE RESTRICTED ITEM</string> <string name="please_set_item_aside"><![CDATA[Please place the item aside in your shopping cart and purchase it at the checkout counter.]]></string> <string name="item_price_not_recognized">ITEM/PRICE NOT RECOGNIZED</string> <string name="hint"><u>Hint</u></string> <string name="you_may_still_use">You may still use the Swift Shopper app to scan and purchase all of your items that are not age restricted.</string> <string name="item_not_available_warning_title">Item not recognized. Please try to scan the item again.</string> <string name="trouble_scanning">Trouble Scanning</string> <string name="item_not_available_warning_message">If you have already tried multiple times to scan this item then please place this item aside in your shopping cart and purchase the item separately through traditional checkout.</string> <string name="item_not_available_hint_message">You may still use the Swift Shopper app to scan and purchase any other items which have successfully been scanned to your cart.</string> <string name="total_amount_validation">Total amount should be greater than zero.</string> <string name="create_a_list_to_start">Please create a list to start planning</string> <string name="create_a_list">Create a List</string> <string name="thanks_for_your_purchase">Thanks for your purchase.</string> <string name="item">ITEM</string> <string name="amount">AMOUNT</string> <string name="tax_payment_receipt">TAX</string> <string name="item_count_payment_receipt">Item Count</string> <string name="list_is_already_downloaded"></string> <string name="none">None</string> <string name="value_add_item">add_item</string> <string name="value_add_item_to_list">add_item_to_list</string> <string name="value_add_item_to_cart">add_item_to_cart</string> <string name="value_add_loyalty_card">add_loyalty_card</string> <string name="value_check_in">check_in</string> <string name="value_qr_code_scan">qr_code_scan</string> <string name="value_check_out">checkout_payment</string> <string name="value_scan_barcode">scan_barcode</string> <string name="arg_item_has_no_code">item_has_no_code</string> <string name="arg_item_code">item_code</string> <string name="arg_barcode_value">barcode_value</string> <string name="arg_barcode_type">barcode_type</string> <string name="item_count">Item %1d/%2d</string>

Page 150 of 168

Page 151: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

<string name="lab_edit">Edit</string> <string name="lab_estimate_total">Estimate total</string> <string name="lab_create_new_list">Create new list</string> <string name="lab_shared_lists">Shared lists</string> <string name="lab_private_lists">Private lists</string> <string name="lab_scan_to_list">Scan to List</string> <string name="lab_scan_to_cart">Scan to Cart Item</string> <string name="lab_shopping_cart">Shopping Cart</string> <string name="lab_order_summary">Order Summary</string> <string name="lab_check_in">Check In</string> <string name="loyalty_card_number">Loyalty Card Number</string> <string name="scan_loyalty_card_title">Scan Loyalty Card</string> <string name="camera_rationale">Camera permission is needed to scan barcodes into the app.</string> <string name="item_name_order">%s Order</string> <string name="number_item_name">%d %s</string> <string name="more_than_99">99+</string> <string name="tax_with_percentage">%s%%</string> <string name="integer_percentage">%d%%</string> <string name="price_format">%.2f</string> <string name="integer">%d</string> <string name="no_orders">Hey! looks like you don\'t have any orders.</string> <string name="save_changes">Save changes?</string> <string name="list_with_name_already_exists">List with name \"%s\" already exists. Try again with another name.</string> <string name="photo_not_saved">Photo not saved. Please try again.</string> <string name="no_stores_available">No Stores Available</string> <string name="txt_scanner">Scanner Guide Bar</string> <string name="no_partner_store">Non-Partner Store</string> <string name="title_activity_add_to_list">Add to List</string> <string name="settings_list_sorted">How do you want your lists sorted?</string> <string name="title_activity_settings">Settings</string> <string name="txt_notifications">Notifications</string> <string name="edit_item">Edit Item</string> <string name="msg_no_internet_available">Please check your internet.</string> <string name="please_enter_item_name">Please enter item name.</string> <string name="item_already_exists">%s with same name already exists in this list.</string> <string name="enter_list_name">Enter list name</string> <string name="delete_item">Delete Item</string> <string name="description">Description</string> <string name="upc_code">UPC Code</string> <string name="size">Size</string> <string name="tax">Tax</string> <string name="price">Price</string> <string name="quantity">Quantity</string> <string name="item_name">Item Name</string> <string name="item_name_1">Item Name?</string> <string name="please_select_loyalty_card_image">Please select loyalty card image</string>

Page 151 of 168

Page 152: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

<string name="please_scan_loyalty_card_barcode">Please scan loyalty card barcode</string> <string name="terms_and_conditions">Terms &amp; Conditions</string> <string name="i_accept_the">I accept </string> <string name="deals_in_your_area_title">Deals in Your Area</string> <string name="deals_title">Deals</string> <string name="txt_deals_desc_empty">Hey! looks like you don\'t have \nany deals yet.</string> <string name="txt_deals_desc_empty_1">Add items to your lists for\nRelevant Deals</string> <string name="txt_store">Store:&#160;</string> <string name="txt_aisle">Aisle:&#160;</string> <string name="txt_category">Category:&#160;</string> <string name="txt_description">Description:&#160;</string> <string name="txt_loading_deals">Getting Deals&#8230;</string> <string name="txt_adding_deals">Adding Deals&#8230;</string> <string name="location_rationale_deals">Location is needed to find nearby deals.</string> <string name="txt_add_to_list">Add to List</string> <string name="ad_adpated_desc">Do you want to add %1$s into your list?</string> <string name="dialog_loyalty_cancel">Cancel</string> <string name="dialog_loyalty_yes">Yes</string> <string name="dialog_loyalty_no">No</string> <string name="page_view_login">Login</string> <string name="page_view_go_shop">Go Shop</string> <string name="page_view_lists">Lists</string> <string name="page_view_deals">Deals</string> <string name="page_view_frequent">Frequent</string> <string name="page_view_cards">Cards</string> <string name="page_view_checkout">Checkout</string> <string name="page_view_check_in">Check-In</string> <string name="lists_create_new_list">Create New List</string> <string name="create_new_list_enter_list_name">Enter List Name</string> <string name="title_activity_create_new_list">Create a List</string> <string name="shared_lists">Shared Lists</string> <string name="private_lists">My Lists</string> <string name="create_new_list">Create New List</string> <string name="share_list_message_title">%1$s Share List</string> <string name="share_list_message">Hey checkout my list with %1$s!\n\n%2$s</string> <string name="share_list_chooser_title">Share Via</string> <string name="edit">Edit</string> <string name="estimate_total">Estimated total</string> <string name="sub_total">Subtotal</string> <string name="add_to_list">Enter name or item code to add to list</string> <string name="lists_scan_to_list">Scan to list</string> <string name="lists_scan_to_cart">Scan to cart</string> <string name="create_new_list_create_a_link">Create a link</string> <string name="create_new_list_clear_checked_items">Clear checked items</string> <string name="create_new_list_delete_this_list">Delete this list</string> <string name="dashboard_menu_done">Done</string> <!--Create / Edit-->

Page 152 of 168

Page 153: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

<string name="delete_list_title">Delete this list</string> <string name="delete_list_description">Are you sure you want to delete this list ?</string> <!-- Dialog Delete --> <string name="dialog_delete_list_title">Delete Confirmation?</string> <string name="dialog_delete_list_desc">Are you sure you want to delete this list ?</string> <string name="dialog_delete_list_item_desc">Are you sure you want to delete this item ?</string> <string name="dialog_delete_list_item_desc_shared_list">This is a shared List. Deleting this item will remove it from everyone with whom you may have shared it. Proceed?</string> <string name="dialog_delete_list_item_desc_1">Are you sure you want to delete this item from cart?</string> <string name="dialog_delete_share_list_desc">This is a shared list. Deleting this list will remove it from everyone with whom you may have shared it. Proceed?</string> <string name="share_confirm_desc">To use the Share Feature please login and accept the terms of service</string> <string name="view_shared_list_needs_login">Please login and accept the terms of service to access this shared list.</string> <string name="btn_go_to_login">Go to Login</string> <string name="btn_login">Login</string> <string name="btn_i_am_sure">I\'m Sure</string> <string name="dialog_delete_crossed_off_item_title">Delete List Item</string> <string name="dialog_delete_crossed_off_item_desc">Would you like to clear crossed off items from your list?</string> <string name="title_activity_edit_list">Edit List</string> <string name="list_already_downloaded">is already downloaded</string> <string name="this_list_is_already_shared">This list is already shared.</string> <string name="details">Details</string> <string name="item_delete">Delete Item</string> <string name="item_price">$%.2f</string> <string name="home_title">Swift Shopper</string> <string name="share_your_list">Share</string> <string name="plan">PLAN</string> <string name="shop">SHOP</string> <string name="shop_from_list">SHOP FROM LIST</string> <string name="shop_on_the_fly">SHOP ON THE FLY</string> <string name="select_list">Create a List</string> <string name="tap_to_activate_scan_to_cart">Tap to SCAN item to CART</string> <string name="tap_to_activate_scan_to_list">Tap to SCAN item to LIST</string> <string name="select_list_to_start_shopping">Please Select a List</string> <string name="no_shared_lists_available">No shared lists available</string> <string name="no_private_lists_available">No lists available</string> <string name="sort_by">Sort By</string> <string name="tab_cart">Cart</string> <string name="tab_frequent">Frequent</string> <string name="tab_cards">Cards</string> <string-array name="image_picker"> <item>Take Photo</item>

Page 153 of 168

Page 154: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

<item>Image from Gallery</item> </string-array> <string name="tab_all_deals">All Deals</string> <string name="tab_my_deals">My Deals</string> <string name="lab_checkout">Checkout</string> <string name="lab_cancel_cart">Cancel Cart</string> <string name="lab_cart_empty">Your shopping cart is empty.\nPlease SCAN items to your cart.</string> <string name="your_cart_is_empty">Your cart is empty!</string> <string name="msg_cart_item_added_successfully">Item added successfully in cart</string> <string name="subtotal">Subtotal</string> <string name="items">Items</string> <string name="item_price_format">$%.2f</string> <string name="delete">Delete</string> <string name="item_got_it">Got It</string> <string name="item_scan">Scan</string> <string name="item_add_to_cart">Add to Cart</string> <string name="item_no_barcode">No Barcode?</string> <string name="item_remove_from_cart">Remove from Cart</string> <string name="item_quick_add">Quick Add</string> <string name="shared_list_imported_but_not_logged_in">Please login to view this list.</string> <string name="shared_list_link_validation_error">There is a problem with the link for the shared list.</string> <string name="term_and_policy_swift_shopper">Terms of Services &amp; \nPrivacy Policy.</string> <string name="enter_item_name">Enter Item Name</string> <string name="enter_item_name_1">Enter item name</string> <string name="add_to_cart">Add To Cart</string> <string name="cancel">Cancel</string> <string name="add">Add</string> <string name="txt_terms_and_conditions"><![CDATA[Please accept the Terms & Conditions.]]></string> <string name="dialog_image_picker_title">Pick your image</string> <string name="dialog_image_picker_desc">Choose your product image either from gallery or camera</string> <string name="dialog_image_picker_camera">Take Photo</string> <string name="dialog_image_picker_gallery">Image from Gallery</string> <string name="dialog_image_picker_ok">OK</string> <string name="dialog_image_picker_cancel">Cancel</string> <string name="title_permission_camera">Allow camera and storage permission</string> <string name="msg_ration_camera">Camera and storage permission are needed to take and save a picture.</string> <string name="msg_setting_camera">Camera and storage permission are needed to take and save a picture. Please visit the app\'s settings to grant permission.</string> <string name="title_permission_library">Allow storage permission</string> <string name="msg_ration_library">Storage permission is needed so you can choose a picture.</string> <string name="msg_setting_library">Storage permission is needed so you can choose a picture. Please visit the app\'s settings to grant permission.</string> <string name="title_permission_camera_scan">Allow camera permission</string>

Page 154 of 168

Page 155: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

<string name="msg_ration_camera_scan">Camera permission is needed to scan barcodes into the app.</string> <string name="msg_setting_camera_scan">Camera permission is needed to scan barcodes into the app. Please visit the app\'s settings to grant permission.</string> <string name="dialog_no_barcode_item_no_code">Trouble Scanning?</string> <string name="add_item_list_title_1">Add to List</string> <!--Exit Store Dialog--> <string name="dialog_title_cancel_cart">Cancel Cart</string> <string name="tap_to_scan">Tap to Scan</string> <string name="deals">Deals</string> <!--Store Welcome Dialog--> <string name="enter_the_store">Enter</string> <plurals name="number_of_items"> <item quantity="one">%d Item</item> <item quantity="other">%d Items</item> </plurals> <!-- Checkout Completed at --> <string name="lab_checkout_complete_at">Checkout Complete at</string> <string name="swift_shopper_flypass_show_receipt_extra_text"></string> <string name="lab_thank_you">Thank you!</string> <string name="lab_show_receipt_desc">Please show the following receipt at the exit door for validation.</string> <string name="lab_show_receipt">Show Receipt</string> <string name="lab_exit">Exit</string> <!-- Payment Receipt --> <string name="lab_payment_receipt_title">Payment Receipt</string> <string name="lab_merchant_id">Merchant ID:</string> <string name="lab_transaction_id">Transaction ID:</string> <string name="lab_payment_type">Payment Type</string> <string name="lab_purchase">Purchase</string> <string name="lab_google_pay">Google Pay</string> <string name="lab_thanks_for_your_purchase">Thanks for your purchase.</string> <string name="lab_return_to_home">Receipt Validated</string> <!-- Past Order Details Screen --> <string name="order_history">Order History</string> <string name="order_details">Order Details</string> <string name="past_order_title">Item Name</string> <string name="past_order_qty">Qty</string> <string name="past_order_price">Price</string> <!-- Order Summary --> <string name="lab_sub_total">Subtotal</string> <string name="lab_sales_tax">Tax</string> <string name="lab_total">Total</string>

Page 155 of 168

Page 156: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

<string name="btn_google_pay_content">Pay with Google</string> <string name="msg_ready_for_pay">Ready to make payment</string> <string name="msg_payment_canceled">Payment canceled</string> <string name="msg_got_error_pay">Got error %s</string> <string name="msg_google_pay_not_available">Google Pay is Not Available</string> <string name="delete_loyalty_card_message">Are you sure you want to delete this card?</string> <string name="payment_receipt_subject">%s payment receipt</string> <string name="share_file">Share File</string> <string name="pay">Make Payment</string> <string name="change">Change</string> <string name="checkout">Checkout</string> <string name="google_pay">Google Pay</string> <string name="change_card">Change Card</string> <string name="payment_method">Payment Method</string> <string name="okay">Okay</string> <string name="please_try_again">Please try again or proceed to in-store checkout</string> <string name="please_use_different_card">Please use a different card or proceed to in-store checkout</string> <string name="share">Share</string> <!-- Deals Scan to cart --> <string name="title_deals_scan_to_cart">Scanner</string> <string name="msg_not_match_deal_item">Scanned item does not match this deal.</string> <string name="not_a_valid_barcode">Not a valid barcode</string> <string name="scanned_item_does_not_match">Scanned item does not match this deal.</string> <!--ShopOnFly--> <string name="title_delete_cart">Delete item?</string> <string name="successfully_cleared_checked_items">Successfully cleared checked items!</string> <string name="via">Via</string> <!-- Dialog Checkout complete --> <string name="dialog_checkout_list_title">Checkout Complete</string> <string name="dialog_checkout_list_desc">Would you like to clear crossed off items from your list?</string> <string name="btn_clear">Clear</string> <string name="btn_close">Close</string> <!-- Check Out item --> <string name="txt_manually_check_this_item">Please manually check this item</string> <string name="txt_no_barcode_item_code">This item has no barcode\nor item code</string> <string name="swift_shopper_flythru">%s FlyThru™</string> <string name="swift_shopper_flypass">%s FlyPass™</string> <string name="please_choose">Please Choose</string> <string name="barcode_presented">Barcode Presented</string> <string name="long_press_amp_hold">(Long Press &amp; Hold)</string>

Page 156 of 168

Page 157: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

<!-- Check out Screen --> <string name="check_out_title">Check Out</string> <string name="check_out_status">Item</string> <string name="lab_please_proceed_to">Please present barcode at any</string> <string name="swift_shopper_flythru_show_receipt_extra_text"></string> <string name="lab_designated_checkout_lane">designated checkout lane</string> <!-- Checkout Method Selection --> <string name="lab_attended_checkout2">Checkout Line</string> <string name="lab_in_app_checkout2">Checkout Line</string> <string name="cashier_assisted_payment">Cashier Assisted Payment</string> <string name="mobile_payment">Mobile Payment</string> <string name="str_continue">Continue</string> <string name="title_add_card">Add Card</string> <string name="error_valid_card_details">Please enter valid card details.</string> <string name="context_error">AccessToken cannot be null</string> <string name="access_token_error">AccessToken cannot be null</string> <string name="login_listener_error">LoginListener cannot be null</string> <string name="user_id_error">UserId must be an int > 0</string> <string name="exit_store_error">Please provide an OnExitStoreDialogListener to get a callback when exiting the stored.</string> <string name="logout_error">Please provide a LogoutListener to get a callback after logout.</string> <string name="message_null_sharelistener">Please provide a ShareListener to the SsListView to get a callback when for the \'Share\' action.</string> <!--Login Screen--> <string name="login_desc">Connect your social account to get\nthe best shopping experience.</string> <string name="login_skip">Skip to start using the app</string> <string name="login_or">OR</string> <string name="login_with_google">Sign in with Google</string> <string name="login_with_twitter">Sign in with Twitter</string> <string name="login_with_facebook">Continue with Facebook</string> <string name="login_with_google_btn_desc">Login with Google Button</string> <string name="login_with_twitter_btn_desc">Login with Twitter Button</string> <string name="login_with_facebook_btn_desc">Login with Facebook Button</string> <string name="login_confirmation_title">By logging in you agree to</string> <string name="login_confirmation_i_agree">I Agree</string> <string name="login_confirmation_canel">Cancel</string> <string name="login_confirmation_ampersand">&amp;</string> <string name="login_confirmation_terms_of_services">Terms of Services</string> <string name="login_confirmation_privacy_policy">Privacy Policy</string> <string name="terms_of_services_url">http://swiftshopper.com/terms/</string> <string name="privacy_policy_url">http://swiftshopper.com/wp-content/uploads/2016/12/privacypolicy.html</string> <!--Select Market Screen--> <string name="location_rationale_select_market">Location is needed to find nearby places for you to shop.</string>

Page 157 of 168

Page 158: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Appendix 6: Troubleshooting

App Crashes on Lollipop and Marshmallow at Checkout Screen Exception in Logcat E/AndroidRuntime( 5394): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.swiftshopper.sdk.quickstart/com.swiftshopper.sdk.ui.activity.PleaseChooseActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f0800ba E/AndroidRuntime( 5394): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325) E/AndroidRuntime( 5394): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) E/AndroidRuntime( 5394): at android.app.ActivityThread.access$800(ActivityThread.java:151) E/AndroidRuntime( 5394): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) E/AndroidRuntime( 5394): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime( 5394): at android.os.Looper.loop(Looper.java:135) E/AndroidRuntime( 5394): at android.app.ActivityThread.main(ActivityThread.java:5254) E/AndroidRuntime( 5394): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime( 5394): at java.lang.reflect.Method.invoke(Method.java:372) E/AndroidRuntime( 5394): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) E/AndroidRuntime( 5394): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) E/AndroidRuntime( 5394): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f0800ba E/AndroidRuntime( 5394) at android.content.res.Resources.getValue(Resources.java:1266)E/AndroidRuntime( 5394): at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:331)E/AndroidRuntime( 5394): at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:198)E/AndroidRuntime( 5394): at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:191)E/AndroidRuntime( 5394): at android.support.v7.content.res.AppCompatResources.getDrawable(AppCompatResources.java:102)E/AndroidRuntime( 5394): at com.swiftshopper.sdk.z.p.l.a(Unknown Source)E/AndroidRuntime( 5394): at com.swiftshopper.sdk.ui.view.custom.CustomToolbar.c(Unknown Source)E/AndroidRuntime( 5394): at com.swiftshopper.sdk.ui.activity.PleaseChooseActivity.o(Unknown Source)E/AndroidRuntime( 5394): at com.swiftshopper.sdk.ui.activity.PleaseChooseActivity.a(Unknown Source)E/AndroidRuntime( 5394): at com.swiftshopper.sdk.ui.activity.PleaseChooseActivity.a(Unknown Source)E/AndroidRuntime( 5394): at com.swiftshopper.sdk.base.c.onCreate(Unknown Source)E/AndroidRuntime( 5394): at android.app.Activity.performCreate(Activity.java:5990)E/AndroidRuntime( 5394): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)E/AndroidRuntime( 5394): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)E/AndroidRuntime( 5394): ... 10 more Known Cause: The Swift Shopper SDK attempts to load your app’s “logo small” to potentially display in the “Please Choose” activity’s action bar / toolbar. However, if your “logo small” is a vector drawable this error could occur. The problem is that Android does not gracefully support certain types of vector graphics in these versions of Android.

Page 158 of 168

Page 159: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Known Solution 1: If your “logo small” is indeed a vector graphic, see if you have a corresponding PNG rendition. Convert your vector graphic into a relatively small PNG file. Pass the PNG into as the “logo small” to SwiftShopperSdk.initialize(...) Known Solution 2: The real culprit is that these versions of Android crash when they try to render a vector graphic with a gradient. References:

● https://stackoverflow.com/questions/48948974/getdrawable-notfoundexception-on-5-0

and ● https://stackoverflow.com/questions/48688593/resourcesnotfoundexception-when-resour

ce-available-api-22-and-23-devices?rq=1.

Excerpt:

“Replacing

<aapt:attr name="android:fillColor"> <gradient android:endX="13760.793757781983" android:endY="6638.382661392212" android:startX="3736.5152613830564" android:startY="6573.006932067871" android:type="linear"> <item android:color="#FFFFFFFF" android:offset="0.0"/> <item android:color="#00FFFFFF" android:offset="1.0"/> </gradient> </aapt:attr>

with

android:fillColor = "#FFFFFFFF" fixed the problem. Had to do it manually on all vectors I use, since it was android studio's

SVG parser that parsed original svg for me.”

Page 159 of 168

Page 160: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Emulator Device: SsSelectMarketView’s Loading Animation Spins Forever Known Cause: The emulator’s location services seem to potentially lock up on an emulator device when an emulator device is created and launched for the first time. Known Solution:

1. Power off the emulator device a. Long Press the Power Button on the Emulator Device’s Outer Window b. Then Choose “Power Off” from the Android dialog that appears within the

emulator device

2. Re-open the emulator device 3. Try testing the SsSelectMarketView again.

In all reported cases, this has solved the problem.

Page 160 of 168

Page 161: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Emulator Device: Login Does not Work in SsLoginView’s Browser Symptom: After tapping the “Continue with Facebook”, “Sign-in with Twitter”, or “Sign-in with Google” button a web browser activity is launched in which the login process fails to proceed. The web browser activity does not render the remaining portion of the login. The web browser activity is also not themed to match the app. Known Cause: The SsLoginView performs social media login using the corresponding social provider’s web sign-in mechanisms. These social providers do not support the standard Android browser due to the browser’s outdated security support. Social media login only works for these providers using a browser that features up-to-date security measures. Such a browser is typically installed in real, end-user devices. Known Solution: Install Chrome for Android in the emulator device. This can be tricky since the emulator device likely does not have the Google Play store. Launch the built-in browser and install Chrome for Android by tapping a URL / link to the APK. For example, suitable URL links are available from the “APK Mirror” website. For example: https://www.apkmirror.com/apk/google-inc/chrome/chrome-75-0-3770-101-release/google-chrome-fast-secure-75-0-3770-101-2-android-apk-download/download/ Be sure to download and install the Chrome Android version that is compiled for x86, as x86 is typically the CPU architecture for emulator devices. After downloading the APK, simply tap the “download complete” notification that appears in the emulator’s Android notification bar. Chrome Android will then be installed. If all else fails, use a web browser on your development computer to download the APK to your development computer. Then install the APK into the emulator device using a terminal / command line with the adb install command. For example, assuming you download the APK into /Users/you/Downloads directory: adb install "/Users/you/Downloads/com.android.chrome_75.0.3770.101-377010115_minAPI19(x86)(nodpi)_apkmirror.com.apk"

Page 161 of 168

Page 162: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Appendix 7: Play Store Release The setup instructions back towards the beginning of this document instruct you to add the Swift Shopper SDK’s prerelease version as a gradle dependency for your app. A production version of the Swift Shopper SDK is also available. The Swift Shopper SDK’s prerelease version is nearly identical to the production version, except that the prerelease version uses a sandboxed version of the Swift Shopper cloud infrastructure that is suitable for development, testing and verification of apps that use Swift Shopper prior to publicly releasing any such apps. The Swift Shopper SDK is also available to licensed retailers and their agents in a format that uses the live, production version of the Swift Shopper cloud infrastructure. Differences Between Prerelease and Production SDK: Both versions of the Swift Shopper SDK are full versions built from the same Swift Shopper code base. The prerelease version is simply configured to communicate with the servers and services in the Swift Shopper prerelease cloud infrastructure. The live, production version is configured to communicate with the servers and services in the Swift Shopper live, production cloud infrastructure. Differences Between Prerelease and Production Infrastructure: Payment Processing: The Swift Shopper prerelease infrastructure processes payments in “dry-run” fashion only. When testing Google Pay, you’ll need to provide valid credit card data in order to fully “dry-run” test Google Pay. However, the Swift Shopper prerelease infrastructure will not actually charge the card. When paying directly in your app with a credit card, outside of Google Pay, you will need to enter special test card numbers as described here: https://stripe.com/docs/testing For example: Card number 4242 4242 4242 4242 with any expiration date in the future; and with any 3 digits for the CVC. You can also test negative scenarios such as card declined using corresponding test card numbers as documented at https://stripe.com/docs/testing. Point-Of-Sale Integration: The Swift Shopper prerelease infrastructure synchronizes in-app purchases with the retail store’s back-end point-of-sale system in “dry-run” fashion only, in order to not interfere with ordinary business transactions at the store. SDK Key: Each retailer has two SDK keys: an SDK key valid for development/test apps that are compiled with a Swift Shopper prerelease SDK and an SDK key valid for live/released apps that are compiled with a Swift Shopper production SDK.

Page 162 of 168

Page 163: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Retailer Store Id: The retailer store id that your app might pass to SwiftShopperSdk. enterStore(...) will be a different id for apps that are compiled with a Swift Shopper prerelease SDK versus a Swift Shopper live/production SDK. This affects only those apps that by design work with only and exactly one physical retail store location. Preparing Your App For Play Store Release:

1. Prepare your app for Play Store release following current Google guidelines. 2. Update your app’s gradle dependency to use the latest Swift Shopper SDK production

version. 3. Update your app’s Application class to pass the retailer’s production key into the

SwiftShopperSdk.initialize(...) method. 4. Update any location(s) in your source code that call SwiftShopperFramework.

enterStore(...) to pass in the retailer’s production retail store id if your app calls into SwiftShopperFramework. enterStore(...).

5. Production Test Using Android Emulators for all recent major versions of Android, going back at least to Lollipop.

Page 163 of 168

Page 164: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

Appendix 8: License Agreement SOFTWARE DEVELOPMENT KIT (SDK) LICENSE AGREEMENT Swift Shopper, Inc. DEVELOPMENT KIT (SDK) LICENSE AGREEMENT Thank you for your interest in Swift Shopper, Inc. ("Swift Shopper"), and its shopping platform and associated services (the "Service"), and related software development kit, consisting of the documentation ("Documentation"), redistributable libraries ("Libraries"), sample code ("Sample Code"), and other materials provided to you directly in the applicable SDK download, and any upgrades, modified versions, additions, and improvements therefor, if any (collectively, the "SDK") designed to enable software developers to build applications on top of the Service. This Software License Agreement (the "Agreement") governs use of the SDK by you, and/or the entity on whose behalf you are downloading the SDK ("you"). BY DOWNLOADING, INSTALLING, OR OTHERWISE ACCESSING OR USING THE SDK, YOU AGREE THAT YOU HAVE READ, UNDERSTOOD, AND AGREE TO BE BOUND BY THE AGREEMENT. IF YOU DO NOT AGREE, YOU MAY NOT USE THE SDK. Accordingly, you and Swift Shopper acknowledge and agree as follows: 1. LIMITED LICENSE. Subject to your complete and ongoing compliance with all the terms and conditions set forth in this Agreement, including without limitation all license limitations and restrictions set forth herein, Swift Shopper grants you the following limited, non-exclusive, non-transferable, non-sublicensable, revocable licenses to: a. use, and (where applicable) authorize your employees to use, the Documentation internally solely in connection with developing your own branded applications that interoperate with the Service ("Applications"); b. incorporate unmodified Libraries into your Application, solely for the purpose of enabling interoperability with the Service, solely in accordance with all applicable Documentation and applicable terms, and subject to you obtaining and maintaining an SDK key from Swift Shopper, to distribute Libraries so incorporated in your compliant Application to end users in executable form (except and solely to the extent that the Libraries are written in a language that is traditionally delivered for runtime interpretation in source code form); and c. use, modify, and redistribute the Sample Code pursuant to the applicable open source license, as identified in the headers or associated Documentation.

Page 164 of 168

Page 165: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

2. RESTRICTIONS. By accessing or using the SDK, you represent, warrant, and covenant that (a) you are a person or business entity engaged in the development of software applications, and (b) in the case of a business entity, you have the full power and authority to bind such entity to the terms of this Agreement. References to "you" herein shall refer to you, and/or the entity on whose behalf you are using the SDK, and all individual users of the SDK on behalf of such entity. You acknowledge that the foregoing license does not include any right to (i) redistribute, sell, lease, license, or modify any portion of the SDK, or (ii) distribute, deploy, or otherwise utilize Applications on a public, production, commercial, or other similar purpose other than internal use for evaluation and the development of non-public, experimental Applications (any other public, production, commercial, or similar use requires a separate agreement with Swift Shopper), or (iii) use or implement any undocumented feature or API, or use any documented feature or API other than in accordance with applicable documentation. You may not reproduce, distribute, publicly display, or publicly perform any part of the SDK, except as provided herein or in the applicable open source license. Except if, and solely to the extent that, such a restriction is not authorized herein, or impermissible under applicable law or applicable Third Party Software (defined below) license terms, you may not (w) decompile, reverse engineer, or otherwise access or attempt to access the source code for the SDK not made available to you in source code form, or make or attempt to make any modification to the SDK; or (x) remove, obscure, interfere with or circumvent any feature of the SDK, including without limitation any copyright or other intellectual property notices, security, or access control mechanism; or (y) access the service or the servers or networks providing the service except via the SDK; or (y) create a library, application programming interface, or SDK that functions substantially the same as the service and offer it for use by third parties; or (z) interfere with or disrupt the service or the servers or networks providing the service. You may not use the SDK for any purpose other than interoperating with the Service in a manner for which the SDK and Service are expressly designed. If you are prohibited under applicable law from using the SDK, you may not use them, and you will comply with all applicable laws and regulations (including without limitation laws and regulations related to export controls) in connection with your use of the SDK. Without limiting the generality of the foregoing, you represent and warrant that the SDK will not be shipped, transferred or exported into any country or used in any manner prohibited by the United States Export Administration Act or any other export laws, restrictions or regulations (collectively the "Export Laws"). In addition, if the SDK is identified as export controlled items under the Export Laws, you represent and warrant that you are not a citizen, or otherwise located within, an embargoed nation (including without limitation Crimea, Cuba, Iran, North Korea, Sudan, or Syria and that you are not otherwise prohibited under the Export Laws from receiving the SDK. You may not use the SDK for any purpose, or use the SDK in the development of any Application that is for the purpose of lifesaving, emergency response, or otherwise for deployment in any circumstance in which failure would be likely to lead to property damage, environmental damage, personal injury, or death. ANY USE IN VIOLATION OF THE FOREGOING LIMITATIONS AND RESTRICTIONS IS STRICTLY PROHIBITED, AND UNLICENSED.

Page 165 of 168

Page 166: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

3. RESERVATION OF RIGHTS. The SDK is owned by Swift Shopper and licensed, not sold, to you. The SDK, content, visual interfaces, interactive features, information, graphics, design, compilation, computer code, products, services, and all other elements of the SDK and related documentation (the "Swift Shopper Materials"), are protected by copyright, trade dress, patent, and trademark laws of the United States and other jurisdictions, international conventions, and all other relevant intellectual property and proprietary rights, and applicable laws. As between you and Swift Shopper, all Swift Shopper Materials, including intellectual property rights therein and thereto, are the sole and exclusive property of Swift Shopper or its subsidiaries or affiliated companies and/or its third-party licensors. You may not to sell, license, distribute, copy, modify, publicly perform or display, transmit, publish, edit, adapt, create derivative works from, or make any use of the Swift Shopper Materials except as expressly authorized hereunder. Swift Shopper reserves all rights not expressly granted in this Agreement. You do not acquire any right, title or interest to the Swift Shopper Materials, whether by implication, estoppel, or otherwise, except for the limited rights set forth in this Agreement. 4. CONFIDENTIALITY. The SDK (including as embodied in or utilized by any Application) is the confidential and proprietary information of Swift Shopper, and you may not, during the term or thereafter, disclose them to any third party, or to use them for any purpose other than as expressly provided herein, without a separate written agreement with Swift Shopper authorizing you to do so. 5. FEEDBACK. If you provide Swift Shopper with any comments, bug reports, feedback, enhancements, or modifications proposed or suggested by you for the SDK or the Service ("Feedback"), such Feedback is provided on a non-confidential basis (notwithstanding any notice to the contrary you may include in any accompanying communication), and Swift Shopper shall have the right to use such Feedback at its discretion, including, but not limited to the incorporation of such suggested changes into the Swift Shopper Materials, SDK or Service. You hereby grant Swift Shopper a perpetual, irrevocable, transferable, sublicensable, nonexclusive license under all rights necessary to so incorporate and use your Feedback for any purpose, including to make and sell products and services. 6. THIRD PARTY SOFTWARE. The SDK consists of a package of components, including certain third party software ("Third Party Software") that are provided by their authors under separate license terms (the "Third Party Terms"), as described in more detail in the SDK, and online at https://developer.swiftshopper.com/licenses. Your use of the Third Party Software in conjunction with the SDK in a manner consistent with this Agreement is permitted, however, you may have broader rights under the applicable Third Party Terms and nothing in this Agreement is intended to impose further restrictions on your use of the Third Party Software. 7. TERM AND TERMINATION. This Agreement will remain in effect until terminated. The Agreement, and your rights and licenses hereunder, will terminate immediately upon your breach of the Agreement. You may terminate the Agreement by uninstalling and ceasing all use

Page 166 of 168

Page 167: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

of the SDK. Swift Shopper may terminate this Agreement at any time for any reason, including without limitation any actual or suspected misuse or abuse by you of the SDK or any violation of this Agreement. Following any termination of this Agreement, you must immediately uninstall and cease use of the SDK, and destroy all copies. Sections 2, 3, 4, 5, 6, 7, 8, 8, 9, 10, and 11 shall survive any termination of this Agreement. 8. WARRANTY DISCLAIMER AND LIMITATION OF LIABILITY. THE SDK AND ALL ASSOCIATED DOCUMENTATION, LIBRARIES, AND SAMPLE CODE ARE PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, SWIFT SHOPPER DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OR CONDITIONS OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, TITLE, QUALITY, RESULTS, AND NON-INFRINGEMENT. SWIFT SHOPPER EXPRESSLY DISCLAIMS ANY WARRANTIES OF ANY KIND WITH RESPECT TO THE ACCURACY OR FUNCTIONALITY OF THE SDK, AND WITH RESPECT TO THE ACCURACY, VALIDITY, OR COMPLETENESS OF ANY INFORMATION OR FEATURES AVAILABLE THROUGH THE SDK, OR THE QUALITY OR CONSISTENCY OF THE SDK OR RESULTS OBTAINED THROUGH ITS USE. UNDER NO CIRCUMSTANCES WILL SWIFT SHOPPER BE LIABLE FOR ANY CONSEQUENTIAL, SPECIAL, INDIRECT, INCIDENTAL OR PUNITIVE DAMAGES WHATSOEVER ARISING OUT OF THE USE OR INABILITY TO USE THE SDK, EVEN IF SWIFT SHOPPER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, AND NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY. IN NO EVENT WILL SWIFT SHOPPER'S AGGREGATE LIABILITY FOR DAMAGES ARISING OUT OF THIS AGREEMENT OR THE TERMS EXCEED THE GREATER OF AMOUNTS PAID BY YOU FOR THE SDK, IF ANY, OR $50USD. SOME JURISDICTIONS DO NOT ALLOW LIMITATIONS ON IMPLIED WARRANTIES OR THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, SO THE ABOVE LIMITATIONS MAY NOT APPLY TO YOU. IN SUCH AN EVENT THE ABOVE LIMITATIONS AND EXCLUSIONS WILL BE ENFORCED TO THE MAXIMUM EXTENT PERMITTED UNDER APPLICABLE LAW. 9. INDEMNITY. You agree to indemnify, defend and hold Swift Shopper and its affiliates, officers, directors, suppliers, licensors, and other customers harmless from and against any and all liability and costs, including reasonable attorneys' fees incurred by such parties, in connection with or arising out of your Applications, your use or misuse of the SDK, or your violation of this Agreement, any applicable law or regulation. 10. GOVERNING LAW; VENUE. Any claim relating to the SDK or Service shall be governed by the laws of California, without regard to conflict of laws provisions. Disputes arising under this shall be resolved in, and subject to the sole and exclusive jurisdiction of the state and federal courts located in the Northern District of California.

Page 167 of 168

Page 168: Native SDK for Android Development Guide · 2019-06-27 · 6. Build and run your app Verify that your app successfully runs (in either the emulator or your test android device) just

Swift Shopper Native SDK for Android Development Guide v1.0 2018-Jun-27

11. MISCELLANEOUS. This Agreement is the entire agreement between you and Swift Shopper, and supersedes any and all prior agreements, negotiations, or other communications between you and Swift Shopper, whether oral or written, with respect to the subject matter hereof, and, except as expressly provided herein, cannot be modified except in writing signed by both parties. In the event that any provision of this Agreement is held to be invalid or unenforceable, then: (a) such provision shall be deemed reformed to the extent strictly necessary to render such provision valid and enforceable, or if not capable of such reformation shall be deemed severed from this Agreement; and (b) the validity and enforceability of all of the other provisions hereof, shall in no way be affected or impaired thereby. You may not assign this Agreement without the prior written consent of Swift Shopper, whether expressly or by operation of law, including in connection with a merger or change of control, and any such attempted assignment shall be void and of no effect. Swift Shopper may assign this Agreement without restriction and without any notice to you. Subject to the foregoing, this Agreement shall be binding on the parties and their respective successors and permitted assigns. You acknowledge and understand that if Swift Shopper is unable to provide the SDK as a result of a force majeure event Swift Shopper will not be in breach of this Agreement. A force majeure event means any event beyond the control of Swift Shopper. The failure to exercise, or delay in exercising, a right, power or remedy provided in this Agreement or by law shall not constitute a waiver of that right, power or remedy. Swift Shopper's waiver of any obligation or breach of this Agreement shall not operate as a waiver of any other obligation or subsequent breach of the Agreement. The English language version of this Agreement shall be the official and controlling version, and any translation provided is solely for convenience. The SDK is a "Commercial Item" as that term is defined at 48 C.F.R. 2.101, consisting of "Commercial Computer Software" and "Commercial Computer Software Documentation." If and to the extent the SDK is supplied to or purchased by or on behalf of a United States government entity or an entity licensing the SDK for or on behalf of a United States government entity, the SDK is licensed (a) only as a Commercial Item and (b) with only those rights as are granted to all other end users pursuant to the terms and conditions of this agreement. Last updated: April 30, 2019

Page 168 of 168