The Bazaarvoice Mobile SDKs provide access to most of the core products Bazaarvoice offers. To learn more, go to the Mobile SDK documentation home page.

Contents

(+ show- hide)

This documenation explains the mechanics of submitting consumer-generated content (CGC) to Bazaarvoice using the Mobile SDK.

Introduction

The instructions on this page cover building a request with custom parameters.

Installation instructions

Click here to see how to install and configure the BVSDK.

Installation with Gradle

Include the Maven Central repository and add the appropriate Bazaarvoice Mobile SDK modules to your dependencies:

dependencies {
    implementation 'com.bazaarvoice.bvandroidsdk:curations:{BV_SDK_VERSION}.+' // Provides API Direct
    implementation 'com.bazaarvoice.bvandroidsdk:curations-ui:{BV_SDK_VERSION}.+' // Provides View that Handles API Direct + Analytics for you
    implementation 'com.google.android.gms:play-services-ads:9.{YOUR_PLAY_SERVICES_VERSION}'
    implementation 'com.android.support:recyclerview-v7:25.{YOUR_SUPPORT_LIBRARY_VERSION}'
}
repositories {
    mavenCentral()
}

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

Extending the application

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.

in the following example, YOUR_CLIENT_ID represents your client name, such as "bazaarvoice". If you are unsure about your client ID or API key values, contact Bazaarvoice Support or your implementation team.

public class MyApplication extends Application {

    @Override
    public void onCreate(){
        super.onCreate();
        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>

Using Curations custom post

//Create a BVCurations Instance
BVCurations curations = new BVCurations();

//Create a List of group names to post to
List<String> groups = new LinkedList<>();
groups.add("GROUP_NAME");

//Use the CurationsAuthor.Builder to construct an author with required alias and token fields
//and optional fields
CurationsAuthor author = new CurationsAuthor.Builder("ALIAS", "TOKEN").build();

//Create a List of tags you'd like to give to your custom post
List<String> tags = new ArrayList<>();
tags.add("tag1");
tags.add("tag2");

List<CurationsLink> links = new ArrayList<>();
links.add(new CurationsLink("VALID LINK 1"));
links.add(new CurationsLink("VALID LINK 2"));

List<CurationsPhoto> photos = new ArrayList<>();
photos.add(new CurationsPhoto("VALID PHOTO URL 1"));
photos.add(new CurationsPhoto("VALID PHOTO URL 2"));

//If you have an image you'd like to post you can pass it into the request
Bitmap chosenBmp = null;

//Build your request with requires CurationsAuthor, List of Groups, and post text.
//Add options parameters as well
CurationsPostRequest request = new CurationsPostRequest.Builder(author, groups, "TEXT", listOfCurationsPhotos) //required params
                //Optional Params
                .place("HUMAN READABLE PLACE HERE such as 'Austin, TX'")
                .tags(tags)
                .teaser("YOU TEASER HERE")
                .permalink("DESIRED PERMALINK HERE")
                .links(links)
                .geoCoordinates(37.123, -97.456) // if client app provides geo-location, add in lat/long
                .build();

//Use curations instance to send post request
//and provide a callback to handle successful/unsuccessful requests
curations.postContentToCurations(request, this);