diff --git a/AmazonInAppPurchaseComponent/src/main/AndroidManifest.xml b/AmazonInAppPurchaseComponent/src/main/AndroidManifest.xml
index e359424..d49376b 100644
--- a/AmazonInAppPurchaseComponent/src/main/AndroidManifest.xml
+++ b/AmazonInAppPurchaseComponent/src/main/AndroidManifest.xml
@@ -21,6 +21,13 @@ permissions and limitations under the License.
+
+
+
+
+
diff --git a/Application/app/build.gradle b/Application/app/build.gradle
index 5857549..243bbf0 100644
--- a/Application/app/build.gradle
+++ b/Application/app/build.gradle
@@ -44,8 +44,8 @@ android {
applicationId "com.amazon.android.calypso"
minSdkVersion 21
targetSdkVersion 23
- versionCode 7
- versionName "1.0.3"
+ versionCode 8
+ versionName "1.0.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
@@ -98,6 +98,5 @@ dependencies {
compile project(':AMZNMediaPlayerComponent')
compile project(':PassThroughAdsComponent')
compile project(':PassThroughLoginComponent')
- compile project(':AmazonInAppPurchaseComponent')
compile project(':LoggerAnalyticsComponent')
}
diff --git a/Application/app/src/custom-feeds/config/Navigator.json b/Application/app/src/custom-feeds/config/Navigator.json
index f61b9e8..b5125c9 100644
--- a/Application/app/src/custom-feeds/config/Navigator.json
+++ b/Application/app/src/custom-feeds/config/Navigator.json
@@ -1,7 +1,7 @@
{
"config" : {
- "showRecommendedContent" : true,
- "categoryDefaultRecommendation" : true,
+ "showRelatedContent": true,
+ "useCategoryAsDefaultRelatedContent": true,
"searchAlgo" : "basic"
},
"branding" : {
diff --git a/Application/app/src/custom-feeds/default/Navigator.json b/Application/app/src/custom-feeds/default/Navigator.json
index 51ca2be..0728ad6 100644
--- a/Application/app/src/custom-feeds/default/Navigator.json
+++ b/Application/app/src/custom-feeds/default/Navigator.json
@@ -1,7 +1,7 @@
{
"config": {
- "showRecommendedContent": true,
- "categoryDefaultRecommendation": true,
+ "showRelatedContent": true,
+ "useCategoryAsDefaultRelatedContent": true,
"searchAlgo": "basic"
},
"branding": {
diff --git a/Application/settings.gradle b/Application/settings.gradle
index feb4f74..d9084fc 100644
--- a/Application/settings.gradle
+++ b/Application/settings.gradle
@@ -33,7 +33,6 @@ include ':app',
':PassThroughAdsComponent',
':AMZNMediaPlayerComponent',
':PassThroughLoginComponent',
- ':AmazonInAppPurchaseComponent',
':LoggerAnalyticsComponent'
/* Frameworks */
@@ -59,5 +58,4 @@ project(':PurchaseInterface').projectDir = new File(rootProject.projectDir, '../
project(':AMZNMediaPlayerComponent').projectDir = new File(rootProject.projectDir, '../AMZNMediaPlayerComponent')
project(':PassThroughAdsComponent').projectDir = new File(rootProject.projectDir, '../PassThroughAdsComponent')
project(':PassThroughLoginComponent').projectDir = new File(rootProject.projectDir, '../PassThroughLoginComponent')
-project(':AmazonInAppPurchaseComponent').projectDir = new File(rootProject.projectDir, '../AmazonInAppPurchaseComponent')
-project(':LoggerAnalyticsComponent').projectDir = new File(rootProject.projectDir, '../LoggerAnalyticsComponent')
\ No newline at end of file
+project(':LoggerAnalyticsComponent').projectDir = new File(rootProject.projectDir, '../LoggerAnalyticsComponent')
diff --git a/ComponentTestFramework/EmptyAndroidApp/settings.gradle b/ComponentTestFramework/EmptyAndroidApp/settings.gradle
index e45b4d4..33c2e55 100644
--- a/ComponentTestFramework/EmptyAndroidApp/settings.gradle
+++ b/ComponentTestFramework/EmptyAndroidApp/settings.gradle
@@ -34,13 +34,11 @@ include ':app',
':AmazonInAppPurchaseComponent',
':AMZNMediaPlayerComponent',
':UAMP',
- ':BrightCoveMediaPlayerComponent',
':ContentBrowser',
':CrashlyticsComponent',
':FlurryAnalyticsComponent',
':FreeWheelAdsComponent',
':GoogleAnalyticsComponent',
- ':ImageViewerComponent',
':VastAdsComponent',
':TVUIComponent',
':Application'
@@ -65,13 +63,12 @@ project(':AdobepassAuthComponent').projectDir = new File(rootProject.projectDir,
project(':AmazonInAppPurchaseComponent').projectDir = new File(rootProject.projectDir, "../../AmazonInAppPurchaseComponent")
project(':AMZNMediaPlayerComponent').projectDir = new File(rootProject.projectDir, "../../AMZNMediaPlayerComponent")
project(':UAMP').projectDir = new File(rootProject.projectDir, "../../UAMP")
-project(':BrightCoveMediaPlayerComponent').projectDir = new File(rootProject.projectDir, "../../BrightCoveMediaPlayerComponent")
project(':ContentBrowser').projectDir = new File(rootProject.projectDir, "../../ContentBrowser")
project(':CrashlyticsComponent').projectDir = new File(rootProject.projectDir, "../../CrashlyticsComponent")
project(':FlurryAnalyticsComponent').projectDir = new File(rootProject.projectDir, "../../FlurryAnalyticsComponent")
project(':FreeWheelAdsComponent').projectDir = new File(rootProject.projectDir, "../../FreeWheelAdsComponent")
project(':GoogleAnalyticsComponent').projectDir = new File(rootProject.projectDir, "../../GoogleAnalyticsComponent")
-project(':ImageViewerComponent').projectDir = new File(rootProject.projectDir, "../../ImageViewerComponent")
project(':VastAdsComponent').projectDir = new File(rootProject.projectDir, "../../VastAdsComponent")
project(':Application').projectDir = new File(rootProject.projectDir, "../../Application/app")
project(':TVUIComponent').projectDir = new File(rootProject.projectDir, "../../TVUIComponent/lib")
+
diff --git a/ComponentTestFramework/config.json b/ComponentTestFramework/config.json
index cf483f5..59a8f04 100644
--- a/ComponentTestFramework/config.json
+++ b/ComponentTestFramework/config.json
@@ -89,10 +89,6 @@
"componentName": "ContentBrowser",
"dir": "../ContentBrowser"
},
- {
- "componentName": "ImageViewerComponent",
- "dir": "../ImageViewerComponent"
- },
{
"componentName": "AmazonInAppPurchaseComponent",
"dir": "../AmazonInAppPurchaseComponent"
@@ -100,13 +96,5 @@
{
"componentName": "FlurryAnalyticsComponent",
"dir": "../FlurryAnalyticsComponent"
- },
- {
- "componentName": "BrightCoveMediaPlayerComponent",
- "dir": "../BrightCoveMediaPlayerComponent"
- },
- {
- "componentName": "Application",
- "dir": "../Application/app"
}
-]
\ No newline at end of file
+]
diff --git a/ContentBrowser/src/main/java/com/amazon/android/contentbrowser/ContentBrowser.java b/ContentBrowser/src/main/java/com/amazon/android/contentbrowser/ContentBrowser.java
index ff0b0e8..22dadc7 100644
--- a/ContentBrowser/src/main/java/com/amazon/android/contentbrowser/ContentBrowser.java
+++ b/ContentBrowser/src/main/java/com/amazon/android/contentbrowser/ContentBrowser.java
@@ -1262,7 +1262,7 @@ public void handleOnActivityResult(Activity activity, int requestCode, int resul
* @param screenName Screen name
* @param iScreenSwitchListener Screen switch listener.
*/
- private void verifyScreenSwitch(String screenName,
+ public void verifyScreenSwitch(String screenName,
IScreenSwitchListener iScreenSwitchListener) {
UINode uiNode = (UINode) mNavigator.getNodeObjectByScreenName(screenName);
diff --git a/PurchaseInterface/src/main/AndroidManifest.xml b/PurchaseInterface/src/main/AndroidManifest.xml
index 700de4c..9e99b0b 100644
--- a/PurchaseInterface/src/main/AndroidManifest.xml
+++ b/PurchaseInterface/src/main/AndroidManifest.xml
@@ -13,17 +13,10 @@ express or implied. See the License for the specific language governing
permissions and limitations under the License.
-->
+ package="com.amazon.purchase">
-
-
-
-
-
diff --git a/PurchaseInterface/src/main/java/com/amazon/purchase/PurchaseUtils.java b/PurchaseInterface/src/main/java/com/amazon/purchase/PurchaseUtils.java
index cf61406..1055611 100644
--- a/PurchaseInterface/src/main/java/com/amazon/purchase/PurchaseUtils.java
+++ b/PurchaseInterface/src/main/java/com/amazon/purchase/PurchaseUtils.java
@@ -16,7 +16,6 @@
import com.amazon.android.recipe.Recipe;
import com.amazon.android.utils.FileHelper;
-import com.amazon.auth.R;
import com.amazon.purchase.model.Product;
import com.amazon.purchase.model.Receipt;
import com.amazon.purchase.model.SkuData;
diff --git a/PurchaseInterface/src/main/java/com/amazon/purchase/PurchaseValidAction.java b/PurchaseInterface/src/main/java/com/amazon/purchase/PurchaseValidAction.java
index 70c3202..7a41130 100644
--- a/PurchaseInterface/src/main/java/com/amazon/purchase/PurchaseValidAction.java
+++ b/PurchaseInterface/src/main/java/com/amazon/purchase/PurchaseValidAction.java
@@ -17,7 +17,6 @@
import com.amazon.purchase.model.Receipt;
import com.amazon.purchase.model.Response;
-import android.content.Context;
import android.os.AsyncTask;
import android.util.Log;
diff --git a/TVUIComponent/lib/src/main/java/com/amazon/android/uamp/ui/PlaybackActivity.java b/TVUIComponent/lib/src/main/java/com/amazon/android/uamp/ui/PlaybackActivity.java
index e4ec0f7..f87adb2 100755
--- a/TVUIComponent/lib/src/main/java/com/amazon/android/uamp/ui/PlaybackActivity.java
+++ b/TVUIComponent/lib/src/main/java/com/amazon/android/uamp/ui/PlaybackActivity.java
@@ -36,9 +36,12 @@
import com.amazon.android.contentbrowser.database.ContentDatabaseHelper;
import com.amazon.android.contentbrowser.database.RecentRecord;
import com.amazon.android.contentbrowser.helper.AnalyticsHelper;
+import com.amazon.android.contentbrowser.helper.AuthHelper;
import com.amazon.android.model.content.Content;
import com.amazon.android.module.ModuleManager;
+import com.amazon.android.navigator.Navigator;
+import com.amazon.android.navigator.UINode;
import com.amazon.android.recipe.Recipe;
import com.amazon.android.tv.tenfoot.R;
import com.amazon.android.uamp.DrmProvider;
@@ -255,12 +258,9 @@ protected void onStart() {
}
/**
- * {@inheritDoc}
+ * resume Playback Activity if user Authentication is success
*/
- @Override
- public void onResume() {
-
- super.onResume();
+ private void resumePlaybackAfterAuthentication() {
// Start tracking video position changes.
mVideoPositionTrackingHandler.post(mVideoPositionTrackingRunnable);
@@ -318,6 +318,60 @@ public void onResume() {
}
}
+ /**
+ * Authenticate User On Resume of PlayBackActivity.
+ *
+ * @param screenName Screen name
+ */
+ private void authenticateUserOnResume(String screenName) {
+
+ Navigator mNavigator = ContentBrowser.getInstance(this).getNavigator();
+ AuthHelper mAuthHelper = ContentBrowser.getInstance(this).getAuthHelper();
+ UINode uiNode = (UINode) mNavigator.getNodeObjectByScreenName(screenName);
+ Log.d(TAG, "AuthenticateUserOnResume called in:" + screenName);
+ Log.d(TAG, "AuthenticateUserOnResume needed:" + uiNode.isVerifyScreenAccess());
+ //check if this Screen need Access verification
+ if (uiNode.isVerifyScreenAccess()) {
+ boolean loginLater = Preferences.getBoolean(AuthHelper.LOGIN_LATER_PREFERENCES_KEY);
+ //Check if Authentication can be deferred or not
+ if (!mAuthHelper.getIAuthentication().isAuthenticationCanBeDoneLater() ||
+ (!loginLater && mAuthHelper.getIAuthentication()
+ .isAuthenticationCanBeDoneLater())) {
+ //Check if user is Authenticated for the content
+ mAuthHelper.isAuthenticated().subscribe(extras -> {
+ if (extras.getBoolean(AuthHelper.RESULT)) {
+ //Playback activity need to be resumed as Authentication succeeded.
+ resumePlaybackAfterAuthentication();
+ }
+ else {
+ //Playback activity need to be closed as Authentication failed.
+ finish();
+ Log.i(TAG, "Traversing to details page since user is not authenticated " +
+ "any more");
+ }
+ });
+ }
+ else {
+ resumePlaybackAfterAuthentication();
+ }
+ }
+ else {
+ resumePlaybackAfterAuthentication();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onResume() {
+
+ super.onResume();
+ //Check before resume as user might not authenticated any more. One such scenario is
+ // coming back from next/prev screen when user account has been disabled from server.
+ authenticateUserOnResume(ContentBrowser.CONTENT_RENDERER_SCREEN);
+ }
+
/**
* {@inheritDoc}
*/
@@ -382,6 +436,20 @@ protected void onStop() {
}
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+
+ Log.v(TAG, "onActivityResult called with requestCode:" + requestCode +
+ " resultCode:" + requestCode + " intent:" + data);
+ super.onActivityResult(requestCode, resultCode, data);
+
+ ContentBrowser.getInstance(this)
+ .handleOnActivityResult(this, requestCode, resultCode, data);
+ }
+
/**
* {@inheritDoc}
*/
diff --git a/TVUIComponent/lib/src/main/java/com/amazon/android/uamp/ui/PlaybackOverlayFragment.java b/TVUIComponent/lib/src/main/java/com/amazon/android/uamp/ui/PlaybackOverlayFragment.java
index e046ca3..de6f2d1 100755
--- a/TVUIComponent/lib/src/main/java/com/amazon/android/uamp/ui/PlaybackOverlayFragment.java
+++ b/TVUIComponent/lib/src/main/java/com/amazon/android/uamp/ui/PlaybackOverlayFragment.java
@@ -368,7 +368,9 @@ public void onActionClicked(Action action) {
}
else if (action.getId() == mSkipNextAction.getId()) {
trackAnalyticsAction(AnalyticsTags.ACTION_PLAYBACK_CONTROL_NEXT);
- next();
+ ContentBrowser.getInstance(getActivity()).verifyScreenSwitch(ContentBrowser
+ .CONTENT_RENDERER_SCREEN, extra ->
+ next());
}
else if (action.getId() == mClosedCaptioningAction.getId()) {
toggleCloseCaption();
@@ -376,7 +378,9 @@ else if (action.getId() == mClosedCaptioningAction.getId()) {
}
else if (action.getId() == mSkipPreviousAction.getId()) {
trackAnalyticsAction(AnalyticsTags.ACTION_PLAYBACK_CONTROL_PRE);
- prev();
+ ContentBrowser.getInstance(getActivity()).verifyScreenSwitch(ContentBrowser
+ .CONTENT_RENDERER_SCREEN, extra ->
+ prev());
}
else if (action.getId() == mFastForwardAction.getId()) {
fastForward();
@@ -934,7 +938,9 @@ public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
Content content = (Content) item;
trackAnalyticsAction(AnalyticsTags.ACTION_RECOMMENDED_CONTENT_CLICKED, content);
- mCallback.changeContent(content);
+ ContentBrowser.getInstance(getActivity()).verifyScreenSwitch(ContentBrowser
+ .CONTENT_RENDERER_SCREEN, extra ->
+ mCallback.changeContent(content));
}
}
}
diff --git a/Utils/src/androidTest/java/com/amazon/android/utils/NetworkUtilsTest.java b/Utils/src/androidTest/java/com/amazon/android/utils/NetworkUtilsTest.java
index 6661edb..bc6677d 100644
--- a/Utils/src/androidTest/java/com/amazon/android/utils/NetworkUtilsTest.java
+++ b/Utils/src/androidTest/java/com/amazon/android/utils/NetworkUtilsTest.java
@@ -22,7 +22,10 @@
import java.io.IOException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests for {@link NetworkUtils}
@@ -58,4 +61,76 @@ public void testGetDataLocatedAtUrlWithInvalidUrl() throws IOException {
NetworkUtils.getDataLocatedAtUrl("");
}
+
+ /**
+ * Tests the {@link NetworkUtils#urlContainsParameter(String, String)} method.
+ */
+ @Test
+ public void testUrlContainsParameter() throws Exception {
+
+ String par1 = "param1";
+ String par2 = "app_id";
+ String par3 = "action";
+ String par4 = "empty";
+ String url1 = "http://www.lightcast.com/api/firetv/channels" +
+ ".php?app_id=257&app_key=0ojbgtfcsq12&action" +
+ "=channels_videos";
+ String url2 = url1 + "&" + par4 + "=";
+ String url3 = "www.badurls.comm";
+
+ assertFalse("Parameter should not be found", NetworkUtils.urlContainsParameter(url1, par1));
+ assertTrue("Parameter should be found", NetworkUtils.urlContainsParameter(url1, par2));
+ assertTrue("Parameter should be found", NetworkUtils.urlContainsParameter(url1, par3));
+ assertFalse("Parameter should not be found", NetworkUtils.urlContainsParameter(url2, par4));
+ assertFalse("URL is bad, should be false", NetworkUtils.urlContainsParameter(url3, par1));
+ }
+
+ /**
+ * Tests the {@link NetworkUtils#addParameterToUrl(String, String, String)} method.
+ */
+ @Test
+ public void testAddParameterToUrl() throws Exception {
+
+ String url1 = "http://www.lightcast.com/api/firetv/channels" +
+ ".php?app_id=257&app_key=0ojbgtfcsq12&action" +
+ "=channels_videos";
+ String url2 = "http://www.lightcast.com/api/firetv/channels" +
+ ".php?app_id=257&app_key=0ojbgtfcsq12&action" +
+ "=channels_videos&newparam=";
+ String url3 = "http://www.lightcast.com/api/firetv/channels" +
+ ".php?app_id=257&app_key=0ojbgtfcsq12&newparam=&action" +
+ "=channels_videos";
+ String url4 = "http://www.lightcast.com/api/firetv/channels" +
+ ".php?app_id=257&app_key=0ojbgtfcsq12&action" +
+ "=channels_videos&newparam=differentvalue";
+
+ String param = "newparam";
+ String value = "value1";
+
+ // Contains new param at the end
+ String expected1 = "http://www.lightcast.com/api/firetv/channels" +
+ ".php?app_id=257&app_key=0ojbgtfcsq12&action" +
+ "=channels_videos&newparam=value1";
+ // Contains new param in the middle
+ String expected2 = "http://www.lightcast.com/api/firetv/channels" +
+ ".php?app_id=257&app_key=0ojbgtfcsq12&newparam=value1&action" +
+ "=channels_videos";
+ // Contains a different value for newparam.
+ String expected3 = "http://www.lightcast.com/api/firetv/channels" +
+ ".php?app_id=257&app_key=0ojbgtfcsq12&action" +
+ "=channels_videos&newparam=differentvalue";
+
+ // Test adding a new parameter completely
+ assertEquals("value1 should have been added.",
+ expected1, NetworkUtils.addParameterToUrl(url1, param, value));
+ // Test adding a new parameter if it just has no value in the url
+ assertEquals("value1 should have been added.",
+ expected1, NetworkUtils.addParameterToUrl(url2, param, value));
+ // Test adding a new parameter into the middle of a url
+ assertEquals("value1 should have been added.",
+ expected2, NetworkUtils.addParameterToUrl(url3, param, value));
+ // Test adding a new parameter to url that already contains the parameter.
+ assertEquals("value1 should not have been added.",
+ expected3, NetworkUtils.addParameterToUrl(url4, param, value));
+ }
}
diff --git a/Utils/src/main/java/com/amazon/android/utils/NetworkUtils.java b/Utils/src/main/java/com/amazon/android/utils/NetworkUtils.java
index 30818a6..614754e 100644
--- a/Utils/src/main/java/com/amazon/android/utils/NetworkUtils.java
+++ b/Utils/src/main/java/com/amazon/android/utils/NetworkUtils.java
@@ -26,8 +26,11 @@
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
+import java.util.HashMap;
+import java.util.Map;
/**
* Utility to fetch data from network
@@ -152,4 +155,99 @@ public static String readHttpResult(HttpURLConnection urlConnection) throws IOEx
}
return sb.toString();
}
+
+ /**
+ * Tests for the existence of the given parameter in the URL.
+ *
+ * @param urlString The URL.
+ * @param parameter The parameter to test for.
+ * @return True if the URL contains a value for the given parameter, false otherwise.
+ */
+ public static boolean urlContainsParameter(String urlString, String parameter) {
+
+ try {
+ Map parameters = getUrlQueryParameters(urlString);
+ return parameters.get(parameter) != null && !parameters.get(parameter).isEmpty();
+ }
+ catch (MalformedURLException e) {
+ Log.e(TAG, "Could not test URL for parameter due to malformed URL.", e);
+ }
+ return false;
+ }
+
+ /**
+ * Adds a parameter with the given value to the query of a URL. It will not add the parameter
+ * if a value already exists for the parameter in the query.
+ *
+ * @param urlString The URL.
+ * @param parameter The parameter to add.
+ * @param value The value to add.
+ * @return The URL with the value added, or the original URL if the parameter already exists.
+ */
+ public static String addParameterToUrl(String urlString, String parameter, String value) {
+
+ String newUrlString = urlString;
+ Map queryParams;
+
+ try {
+ queryParams = getUrlQueryParameters(urlString);
+ }
+ catch (MalformedURLException e) {
+ Log.e(TAG, "Could not add parameter to URL due to malformed URL.", e);
+ return newUrlString;
+ }
+
+ // If the url doesn't have the parameter then just add it to the end.
+ if (queryParams.get(parameter) == null) {
+ newUrlString = urlString + "&" + parameter + "=" + value;
+ }
+ // If the url contains the parameter but with no value, insert the value.
+ else if (queryParams.get(parameter).isEmpty()) {
+ String[] split = urlString.split(parameter + "=");
+ if (split.length > 0) {
+ newUrlString = split[0] + parameter + "=" + value;
+ if (split.length > 1) {
+ newUrlString += split[1];
+ }
+ }
+ }
+ else {
+ Log.d(TAG, "Cannot add parameter to URL because it already exists");
+ }
+ return newUrlString;
+ }
+
+ /**
+ * Gets a map representation of the query parameters and their values for the given URL.
+ *
+ * @param urlString The URL.
+ * @return A map of the query parameters and their values.
+ */
+ private static Map getUrlQueryParameters(String urlString) throws
+ MalformedURLException {
+
+ Map queryParams = new HashMap<>();
+ URL url = new URL(urlString);
+ String query = url.getQuery();
+ String[] strParams = query.split("&");
+
+ for (String param : strParams) {
+ String[] split = param.split("=");
+ // Get the parameter name.
+ if (split.length > 0) {
+ String name = split[0];
+ // Get the parameter value.
+ if (split.length > 1) {
+ String value = split[1];
+ queryParams.put(name, value);
+ }
+ // If there is no value just put an empty string as placeholder.
+ else {
+ queryParams.put(name, "");
+ }
+ }
+ }
+
+ return queryParams;
+ }
}
diff --git a/VastAdsComponent/src/main/java/com/amazon/android/ads/vast/VASTAdsPlayer.java b/VastAdsComponent/src/main/java/com/amazon/android/ads/vast/VASTAdsPlayer.java
index e676d9d..63669c4 100644
--- a/VastAdsComponent/src/main/java/com/amazon/android/ads/vast/VASTAdsPlayer.java
+++ b/VastAdsComponent/src/main/java/com/amazon/android/ads/vast/VASTAdsPlayer.java
@@ -53,6 +53,7 @@
import com.amazon.android.ads.vast.util.HttpTools;
import com.amazon.android.ads.vast.util.NetworkTools;
import com.amazon.android.ads.vast.util.VASTLog;
+import com.amazon.android.utils.NetworkUtils;
import android.app.Activity;
import android.content.Context;
@@ -87,8 +88,7 @@ public class VASTAdsPlayer implements IAds,
private static final String TAG = VASTAdsPlayer.class.getSimpleName();
public static final String VERSION = "1.3";
- public static final String VAST_TAG_BUNDLE_KEY = "VASTAdTag";
-
+ private static final String CORRELATOR_PARAMETER = "correlator";
// errors that can be returned in the vastError callback method of the
// VASTPlayerListener
public static final int ERROR_NONE = 0;
@@ -137,13 +137,9 @@ public void init(Context context, FrameLayout frameLayout, Bundle extras) {
mFrameLayout = frameLayout;
mExtras = extras;
- mExtras.putString(VASTAdsPlayer.VAST_TAG_BUNDLE_KEY,
- mContext.getResources().getString(R.string.vast_preroll_tag));
-
DisplayMetrics displayMetrics = mContext.getResources()
.getDisplayMetrics();
-
mScreenWidth = displayMetrics.widthPixels;
mScreenHeight = displayMetrics.heightPixels;
@@ -161,7 +157,15 @@ public void showPreRollAd() {
createSurface(params);
- loadVideoWithUrl(mExtras.getString(VAST_TAG_BUNDLE_KEY));
+ // Get the preroll url and give it a unique timestamp.
+ String preRollUrl = mContext.getResources().getString(R.string.vast_preroll_tag);
+
+ // Try to add a correlator value.
+ preRollUrl = NetworkUtils.addParameterToUrl(preRollUrl, CORRELATOR_PARAMETER,
+ "" + System.currentTimeMillis());
+
+
+ loadVideoWithUrl(preRollUrl);
}
@Override