-
Notifications
You must be signed in to change notification settings - Fork 8
Recommendations
Product Recommendations is currently in BETA! If you would like to participate in the Beta Pilot Program, please contact Mobile Development at Bazaarvoice
This page describes how you configure the Recommendations in your Android Studio project so you can begin to use the funcionality of the Recommendations SDK module.
NOTE: Make sure you have your Shopper Advertising API Key and Client ID before initializing the BVSDK!
Include Maven Central repository and add Common and Advertising modules to dependencies
dependencies {
compile 'com.bazaarvoice.bvandroidsdk:recommendations:3.0.1'
}
repositories {
mavenCentral()
}
###Java - Extend Application
Create a class that extends android.app.Application and initialize the SDK using its builder. Full list of build options are found in BVSDK.java
public class BVApplication extends Application {
@Override
public void onCreate(){
super.onCreate();
// Builder used to initialize the Bazaarvoice SDKs
BVSDK bvsdk = new BVSDK.Builder(this, YOUR_CLIENT_ID)
.bazaarEnvironment(BazaarEnvironment.PRODUCTION) //Either staging or production. Use corresponding API keys
.apiKeyShopperAdvertising(YOUR_SHOPPER_ADVERTISING_API_KEY) //Required for Recommendations
.logLevel(BVLogLevel.INFO)
.build();
}
}
###AndroidManifest - set the name of the class for the application entry and request internet permission
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".BVApplication">
</application>
Once a Recommendations instance has been created, you can also set an authenticated user for profile matching. Please refer to User Authentication for steps on how to accomplish this.
This step is not required, however the end-user may receive trending product recommendations over personalized recommendations.
To set authenticated user call setUserWithAuthString on you Recommendations instance
BVSDK.getInstance().setUserAuthString("USER_AUTH_STRING);
At this point you should be able to fetch a shopper profile with product recommendations.
Recommendations recs = new BVRecommendations();
recs.getRecommendedProducts(20, new Recommendations.BVRecommendationsCallback() {
@Override
public void onSuccess(List<BVProduct> recommendedProducts) {
}
@Override
public void onFailure(Throwable throwable) {
}
});
Refer to Recommendations.java
interface for getting recommendations based on a categoryId or productId.
Refer to RecommendationsFragment
in the app
module for a demo implementation.
© 2016 Bazaarvoice, Inc.
Use of this SDK is contingent on your agreement and conformance with Bazaarvoice's API Terms of Use. Additionally, you agree to store all data acquired by this SDK or Bazaarvoice’s API only within the storage of the individual application instance using the SDK or API. You also agree to use the data acquired by the SDK or API only within the context of the same individual application instance and only for purposes consistent with that application’s purpose. Except as otherwise noted, the Bazaarvoice iOS SDK licensed under the Apache License, Version 2.0.