Skip to content

Commit

Permalink
v4.0.0 Curations Support, BvPixel support, Ads API Update
Browse files Browse the repository at this point in the history
* New Support for Bazaarvoice Curations: Ability to display custom social media feeds and post photos from your mobile app. Checkout the example project
* New BVPixel - Analytics for tracking purchase and non-transaction events for ROI reporting and omnichannel profile
* Added usage pattern for BVRecommendations for fetching and displaying product recommendations
* Removed SDK dependency on Google DFP SDK. Existing clients can now more easily add 1st party data to DFP add requests.
  • Loading branch information
Casey Kulm committed May 4, 2016
1 parent fe253eb commit 86a052c
Show file tree
Hide file tree
Showing 284 changed files with 5,540 additions and 41,187 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@
# Maven stuff
target

# Ignore Jekyll generated docs
_site/

# Ignore generated docs
misc/assets/
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ android:
- extra-google-admob_ads_sdk
- extra-google-m2repository

cache:
directories:
- $HOME/.gradle
#cache:
# directories:
# - $HOME/.gradle

script: TERM=dumb ./gradlew --stacktrace build

sudo: false
sudo: true

13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

# 4.0.0

## Advertising
* New changes to the BVAds class that require some minor code changes to migrate from 3.x to 4.x
* Ads interface removed, instead simply use the BVAds class directly
* ```Map<String, String> getCustomTargeting()``` is the only method available now through ```BVAds.getCustomTargeting()```\
* The methods creating Google DFP ad objects can now just be called by directly invoking the Google DFP API,
e.g. ```getTargetedInterstitialAd(Context context, String adUnitId)``` becomes ```PublisherInterstitialAd interstitialAd = new PublisherInterstitialAd(context); interstitialAd.setAdUnitId(adUnitId);```
* New Support for Bazaarvoice Curations: Ability to display custom social media feeds and post photos from your mobile app. Checkout the example project
* New BVPixel - Analytics for tracking purchase and non-transaction events for ROI reporting and omnichannel profile
* Added usage pattern for BVRecommendations for fetching and displaying product recommendations
* Removed SDK dependency on Google DFP SDK. Existing clients can now more easily add 1st party data to DFP add requests.

# 3.2.1

# General Changes
Expand Down
6 changes: 6 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,15 @@ dependencies {
compile project(':bvandroidsdkadvertising')
compile project(':bvandroidsdkrecommendations')
compile project(':bvandroidsdkconversations')
compile project(':bvandroidsdkcurations')

compile "com.squareup.picasso:picasso:$rootProject.picassoVersion"
compile "org.ocpsoft.prettytime:prettytime:$rootProject.prettyTimeVersion"
compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
compile "com.android.support:design:$rootProject.supportLibraryVersion"
compile "com.android.support:support-v4:$rootProject.supportLibraryVersion"
compile "com.android.support:cardview-v7:$rootProject.supportLibraryVersion"
compile "com.google.android.gms:play-services-ads:$rootProject.playServicesAdsVersion"

// iovation aar dependency
// compile(name:'deviceprint-release-2.3.0', ext:'aar')
Expand All @@ -73,5 +76,8 @@ dependencies {

debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:support-v4:23.2.1'
}



11 changes: 7 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<application
android:name=".DemoApplication"
android:allowBackup="true"
android:icon="@drawable/bv_sample_image"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
Expand All @@ -35,9 +35,12 @@
<activity
android:name=".ads.InterstitialAdActivity"
android:label="@string/title_activity_interstitial_ad" />
<activity android:name=".conversations.browseproducts.ProductsActivity"/>
<activity android:name=".conversations.browseproducts.ReviewsActivity"/>
<activity android:name=".conversations.browseproducts.ProductsActivity" />
<activity android:name=".conversations.browseproducts.ReviewsActivity" />
<activity android:name=".conversations.browseproducts.ReviewDisplayActivity" />
<activity android:name=".curations.DemoCurationsDetailActivity" />
<activity android:name=".curations.DemoCurationsFeedActivity" />
<activity android:name=".curations.DemoCurationsPostActivity" />
</application>

</manifest>
</manifest>
Binary file added app/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.bazaarvoice.bvandroidsdk.BazaarEnvironment;
import com.example.bazaarvoice.bv_android_sdk.di.DemoAppConfigurationImpl;
import com.example.bazaarvoice.bv_android_sdk.di.DemoUserConfiguration;
import com.example.bazaarvoice.bv_android_sdk.di.DemoUserConfigurationImpl;

/**
* TODO: Description Here
Expand Down Expand Up @@ -42,13 +43,18 @@ private void setupBVSDK() {
String clientId = demoUserConfiguration.provideBvClientId();
String shopperAdvertisingApiKey = demoUserConfiguration.provideApiKeyShopperAdvertising();
String conversationsApiKey = demoUserConfiguration.provideApiKeyConversations();
String curationsApiKey = demoUserConfiguration.provideApiKeyCurations();

// Builder used to initialize the Bazaarvoice SDKs
BVSDK bvsdk = new BVSDK.Builder(this, clientId)
.bazaarEnvironment(bazaarEnvironment)
.apiKeyShopperAdvertising(shopperAdvertisingApiKey)
.apiKeyConversations(conversationsApiKey)
.apiKeyCurations(curationsApiKey)
.logLevel(BVLogLevel.VERBOSE)
.build();

// Set user auth string which you may not have until after a user signs in
BVSDK.getInstance().setUserAuthString(DemoUserConfigurationImpl.BV_USER_AUTH_STRING);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;

import com.bazaarvoice.bvandroidsdk.BVProduct;
import com.bazaarvoice.bvandroidsdk.CurationsPostCallback;
import com.bazaarvoice.bvandroidsdk.CurationsPostResponse;
import com.example.bazaarvoice.bv_android_sdk.ads.AdsFragment;
import com.example.bazaarvoice.bv_android_sdk.ads.BannerAdActivity;
import com.example.bazaarvoice.bv_android_sdk.ads.InterstitialAdActivity;
Expand All @@ -26,18 +29,23 @@
import com.example.bazaarvoice.bv_android_sdk.conversations.browseproducts.ProductsActivity;
import com.example.bazaarvoice.bv_android_sdk.conversations.kitchensink.DemoConversationDetailActivity;
import com.example.bazaarvoice.bv_android_sdk.conversations.kitchensink.DemoConversationsFragment;
import com.example.bazaarvoice.bv_android_sdk.recommendations.detail.DemoProductDetailActivity;
import com.example.bazaarvoice.bv_android_sdk.curations.DemoCurationsFeedActivity;
import com.example.bazaarvoice.bv_android_sdk.curations.DemoCurationsFragment;
import com.example.bazaarvoice.bv_android_sdk.curations.DemoCurationsPostActivity;
import com.example.bazaarvoice.bv_android_sdk.recommendations.DemoRecommendationsFragment;
import com.example.bazaarvoice.bv_android_sdk.recommendations.detail.DemoProductDetailActivity;

/**
* TODO: Description Here
*/
public class DemoMainActivity extends AppCompatActivity {
public class DemoMainActivity extends AppCompatActivity implements CurationsPostCallback {
@IdRes
private int fragContainerId;

private DrawerLayout mDrawerLayout;

private MenuItem prevItem;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -77,10 +85,19 @@ public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}

private void setupDrawerContent(NavigationView navigationView) {
private void setupDrawerContent(final NavigationView navigationView) {

MenuItem item = navigationView.getMenu().getItem(0);
item.setChecked(true);
prevItem = item;

navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(MenuItem item) {

prevItem.setChecked(false);
prevItem = item;

switch (item.getItemId()) {
case R.id.home_page:
transitionTo(DemoHomePageFragment.newInstance());
Expand All @@ -97,6 +114,9 @@ public boolean onNavigationItemSelected(MenuItem item) {
case R.id.browse_products:
transitionTo(BrowseProductsFragment.getInstance());
break;
case R.id.curations:
transitionTo(DemoCurationsFragment.newInstance());
break;
}

// Close the navigation drawer when an item is selected.
Expand Down Expand Up @@ -145,5 +165,25 @@ public void transitionToProductSearch(String query){
intent.putExtra("searchTerm", query);
startActivity(intent);
}

public void transitionToCurationsFeed(){
Intent intent = new Intent(this, DemoCurationsFeedActivity.class);
startActivity(intent);
}

public void transitionToCurationsPost(){
Intent intent = new Intent(this, DemoCurationsPostActivity.class);
startActivity(intent);
}

@Override
public void onSuccess(CurationsPostResponse response) {
Log.d("success", response.getRemoteUrl());
}

@Override
public void onFailure(Throwable throwable) {
Log.d("asd", throwable.getMessage());
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;

import com.example.bazaarvoice.bv_android_sdk.DemoMainActivity;
import com.example.bazaarvoice.bv_android_sdk.R;
import com.example.bazaarvoice.bv_android_sdk.di.DemoAppConfigurationImpl;
import com.example.bazaarvoice.bv_android_sdk.di.DemoUserConfiguration;
import com.example.bazaarvoice.bv_android_sdk.di.DemoUserConfigurationImpl;

/**
* TODO: Description Here
Expand All @@ -40,52 +41,61 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.frag_ads, container, false);

checkForDemoInput();
readyForDemo();

Button nativeBtn = (Button) view.findViewById(R.id.nativeAdBtn);
nativeBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((DemoMainActivity)getActivity()).transitionToNativeAd();
if (readyForDemo()) {
((DemoMainActivity) getActivity()).transitionToNativeAd();
}
}
});

Button interstitialBtn = (Button) view.findViewById(R.id.interstitialAdBtn);
interstitialBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((DemoMainActivity)getActivity()).transitionToInterstitialAd();
if (readyForDemo()) {
((DemoMainActivity) getActivity()).transitionToInterstitialAd();
}
}
});

Button bannerBtn = (Button) view.findViewById(R.id.bannerAdBtn);
bannerBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((DemoMainActivity)getActivity()).transitionToBannerAd();
if (readyForDemo()) {
((DemoMainActivity) getActivity()).transitionToBannerAd();
}
}
});

return view;
}

private void checkForDemoInput() {
private boolean readyForDemo() {
DemoUserConfiguration demoUserConfiguration = DemoAppConfigurationImpl.getInstance().provideBvUserComponent();
String shopperAdKey = demoUserConfiguration.provideApiKeyShopperAdvertising();
String clientId = demoUserConfiguration.provideBvClientId();

String errorVal = null;
if (shopperAdKey.equals("REPLACE_ME")) {
errorVal = "shopperAdKey";
} else if (clientId.equals("REPLACE_ME")) {
errorVal = "clientId";
if (shopperAdKey.equals(DemoUserConfigurationImpl.REPLACE_ME)) {
errorVal = "SHOPPER_ADVERTISING_API_KEY";
} else if (clientId.equals(DemoUserConfigurationImpl.REPLACE_ME)) {
errorVal = "BV_CLIENT_ID";
}

if (errorVal != null) {
String errorMessage = String.format(getResources().getString(R.string.view_demo_error_message), errorVal);
Toast.makeText(getContext(), errorMessage, Toast.LENGTH_LONG).show();
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(errorMessage);
builder.setNegativeButton("Ok",null).create().show();
return false;
}
}


return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@
import android.widget.FrameLayout;
import android.widget.TextView;

import com.bazaarvoice.bvandroidsdk.BVAdListener;
import com.bazaarvoice.bvandroidsdk.BVAds;
import com.example.bazaarvoice.bv_android_sdk.R;
import com.example.bazaarvoice.bv_android_sdk.di.DemoAppConfiguration;
import com.example.bazaarvoice.bv_android_sdk.di.DemoAppConfigurationImpl;
import com.example.bazaarvoice.bv_android_sdk.di.DemoUserConfiguration;
import com.example.bazaarvoice.bv_android_sdk.di.DemoUserConfigurationImpl;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.doubleclick.PublisherAdRequest;
import com.google.android.gms.ads.doubleclick.PublisherAdView;

import java.util.Map;

/**
* TODO: Description Here
*/
Expand All @@ -41,12 +44,11 @@ protected void onCreate(Bundle savedInstanceState) {
bannerAdFailure = (TextView) findViewById(R.id.banner_ad_failure);

DemoAppConfiguration demoAppConfiguration = DemoAppConfigurationImpl.getInstance();
BVAds bvAds = demoAppConfiguration.provideBvAds();
DemoUserConfiguration demoUserConfiguration = demoAppConfiguration.provideBvUserComponent();
String bvAdUnitId = demoUserConfiguration.provideBannerAdUnitId();

// get a PublisherAdView object from the BVAdsSDK
publisherAdView = bvAds.getTargetedAdView(getApplicationContext());
publisherAdView = new PublisherAdView(this);

// setup the PublisherAdView as you normally would - setting the adUnitId and desired ad size.
// in this case, a 320x100 Large Banner ad is requested from DFP
Expand All @@ -56,28 +58,32 @@ protected void onCreate(Bundle savedInstanceState) {
publisherAdView.setLayoutParams(layoutParams);

// optional: set a BVAdListener to track the lifecycle of the ad
publisherAdView.setAdListener(new BVAdListener(bvAds, publisherAdView) {
publisherAdView.setAdListener(new AdListener() {
@Override
public void bvOnAdLoaded() {
public void onAdLoaded() {
super.onAdLoaded();
showSuccess();
}

@Override
public void bvOnAdFailedToLoad(int errorCode) {
public void onAdFailedToLoad(int errorCode) {
super.onAdFailedToLoad(errorCode);
showFailure();
}
});

// get the PublisherAdRequest that BVAdsSDK has set targeting information on.
// provided as the Builder, to allow interacting with it further to set other information
// like gender, birthday, etc.
targetedAdRequest = bvAds.getTargetedAdRequest();
// Add Bazaarvoice targeting keywords
targetedAdRequest = new PublisherAdRequest.Builder();
Map<String, String> targetingKeywords = BVAds.getCustomTargeting();
for (Map.Entry<String, String> entry : targetingKeywords.entrySet()) {
targetedAdRequest.addCustomTargeting(entry.getKey(), entry.getValue());
}

// Add deviceId for emulator
// You can also add your own for a specific hardware device
targetedAdRequest.addTestDevice(PublisherAdRequest.DEVICE_ID_EMULATOR);
String testDeviceId = demoUserConfiguration.provideTestDeviceId();
if (testDeviceId != null && !testDeviceId.equals("REPLACE_ME")) {
if (testDeviceId != null && !testDeviceId.equals(DemoUserConfigurationImpl.REPLACE_ME)) {
targetedAdRequest.addTestDevice(testDeviceId);
}

Expand Down
Loading

0 comments on commit 86a052c

Please sign in to comment.