Installation

This guide shows you how to install and import the Bazaarvoice Mobile SDK into your Android app.

Prerequisites

  • Signed Data Usage Amendment, if not already in place
  • Minimum Android deployment target of 4.1.0 (API Level 16)
  • Android Studio
  • Your Client ID
  • API key(s) for Bazaarvoice products you have enabled

Versioning

The Mobile SDK for Android is versioned so that we can release new features, bug fixes and improvements without compromising the stability of applications using older versions.

This table summarises the major version releases. For more information refer to the Mobile SDK for Android Github repo.

Version Release Date Status
1 Jul 26, 2012 Deprecated
2 Jan 31, 2013 Deprecated
3 Mar 8, 2016 Deprecated
4 May 4, 2016 Deprecated
5 Oct 31, 2016 Supported
6 Jan 23, 2017 Supported
7 June 18, 2018 Supported
8 October 1st, 2018 Latest

Deprecated

These versions should not be expected to return data and/or may experience service degradation. Documentation specific to these versions may no longer be available. These versions should not be used by any applications.

Supported

Supported versions continue to receive security and bug fixes, but applications using these versions should be upgraded to the latest version when possible to take advantage of new features. New applications should not use these versions.

Latest

This is newest version. New applications SHOULD use the most recent release of this version.

Installing with Gradle

πŸ“˜

For manual installation using archive builds (.aar), use the latest archive version on the BVSDK Maven repository.

Add the following dependencies to include the Maven Central repository and add Bazaarvoice Mobile SDK modules. You only need to add the dependencies for the products you have an API key for.

dependencies {  
  implementation 'com.bazaarvoice.bvandroidsdk:analytics:{BV_SDK_VERSION}.+'  
  implementation 'com.bazaarvoice.bvandroidsdk:auth-iovation:{BV_SDK_VERSION}.+'  
  implementation 'com.bazaarvoice.bvandroidsdk:conversations:{BV_SDK_VERSION}.+'  
  implementation 'com.bazaarvoice.bvandroidsdk:curations:{BV_SDK_VERSION}.+'  
  implementation 'com.bazaarvoice.bvandroidsdk:curations-ui:{BV_SDK_VERSION}.+'  
  implementation 'com.bazaarvoice.bvandroidsdk:location:{BV_SDK_VERSION}.+'  
  implementation 'com.bazaarvoice.bvandroidsdk:recommendations:{BV_SDK_VERSION}.+'  
  implementation 'com.bazaarvoice.bvandroidsdk:store-notifications:{BV_SDK_VERSION}.+'  
}  
repositories {  
  mavenCentral()  
}

Replace the {tokens}, including brackets, with the appropriate values. Refer to the Installation guide for {BV_SDK_VERSION}.

Downloading the iovation SDK

Refer to the Device Fingerprinting topic to download and add the iovation SDK to your project. This SDK is required to ensure authenticity in user-generated content.


Configuring the BVSDK

Once you have installed the source code for the SDK, you are now ready to initialize the BVSDK with your API key(s) and environment (staging versus production).

1. Select configuration options

The table below will generate a configuration file for your SDK. The values you set will generate the necessary script and Mobile SDK intialization code to get you up and running quickly.

Each client application should have its own API key. If you need to generate a new key for Conversations please see Conversations Requesting API Keys.

For all other API keys or if you don't know your client ID, contact Bazaarvoice Support or your implementation team.


Products Production Staging
Curations
Conversations
Conversations for Stores
Product Recommendations & Advertising
Analytics Locale

πŸ“˜

Enter your Client ID and at least one API key.

Download your configurations and add them to your assets directory.

Once this is done you may proceed to step 2.

2. Initialize the BVSDK

Create a class that extends android.app.Application, and initialize the Mobile SDK using its builder.

You can find a full list of build options in BVSDK.java.

      public class MyApplication extends Application {
        @Override
        public void onCreate(){
          super.onCreate();
          // BazaarEnvironment.PRODUCTION reads from bvsdk_config_prod.json
          // BazaarEnvironment.STAGING reads from bvsdk_config_staging.json
          BVSDK.builder(application, BazaarEnvironment.PRODUCTION)
            .logLevel(BVLogLevel.VERBOSE) // Optional: Set the log level. Default level is ERROR.
            .dryRunAnalytics(false)       // Optional: Set analytics to log only, not make a network request. Default is false.
            .okHttpClient(okHttpClient)   // Optional: Use you own okHttpClient instance
            .build();
        }
      }

App manifest file

Add the following to your AndroidManifest.xml file.

<!-- set the name of the class for the application entry -->
<application
  android:name=".MyApplication">
</application>

Bazaarvoice SDK dependencies

In case your app and our SDK use different versions of the same dependencies, we have compiled a list of the dependencies each of our modules has below to help debug.

If your app pulls in any com.android.support, com.google.android.gms, or com.gimbal.android.v2 modules, it would be best for you to look at the specific modules that we request from those packages below. Redeclare them in your build.gradle with the explicit version you would like. This will avoid any 'duplicate class' issues while compiling.

Analytics

  implementation "com.squareup.okhttp3:okhttp:3.10.0"
  implementation "com.google.android.gms:play-services-ads:15.0.0"
  implementation "com.android.support:support-annotations:27.0.0"

Common

Inherits from analytics, and adds:

  implementation "com.google.code.gson:gson:2.8.5"
  implementation "com.android.support:recyclerview-v7:27.0.0"

Advertising

Inherits from common, no additional dependencies.

Auth-Iovation

Inherits from conversations, and adds:

  implementation('com.iovation.fraudforce.lib.FraudForce:fraudforce-lib-release-3.0.1:3.0.1@aar')

Conversations

Inherits from common, no additional dependencies.

Curations

Inherits from common, no additional dependencies.

Location

Inherits from common, and adds:

  implementation "com.gimbal.android.v2:gimbal-sdk:2.72"
  implementation "com.gimbal.android.v2:gimbal-slf4j-impl:2.72"
  implementation "com.android.support:appcompat-v7:27.0.0"

Notifications

Inherits from common, and adds:

  implementation "com.android.support:appcompat-v7:27.0.0"

Recommendations

Inherits from common, no additional dependencies.

Store notifications

Inherits from location, notifications, and conversations. No additional dependencies.


Shrink, Obfuscate, and Optimize your App

Users often avoid downloading apps that seem too large. To help you reduce size of the app, Bazaarvoice Android SDK has now added support for R8 compiler to shrink, obfuscate and optimize your app.

When you set the minifyEnabled property to true, R8 perform these tasks for your project's release build type. This property is available in the app's build.gradle file as shown in the below code snippet:

When set to true, the R8 compiler removes some of the unused code. However, some situations are difficult for R8 to analyze correctly and it might remove code your app actually needs. To fix errors and force R8 to keep certain code, add a [-keep](https://www.guardsquare.com/manual/configuration/usage#keepoptions) line in the ProGuard rules file.

buildTypes {  
    release {  
        minifyEnabled true  
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'  
    }  
}

The Bazaarvoice Android SDK will configure its Proguard rules using proguard-rules.txt where the keep rules for BVConversations module are defined. Those keep rules tell R8 to not only keep that code in your app's final DEX but also retain its original naming. This is required to preserve the method/field (and its name) as well as the class name intact, and avoid incorrect obfuscation and errors while using BVConversations module.

Completing installation

After you've completed the above steps, the Bazaarvoice Mobile SDK should be configured and installed. If you encounter difficulties, contact Bazaarvoice Support or your implementation team.