Skip to content

Commit 6bc6872

Browse files
Merge 124c04e into 03d8a69
2 parents 03d8a69 + 124c04e commit 6bc6872

File tree

4 files changed

+28
-4
lines changed

4 files changed

+28
-4
lines changed

iterableapi/src/main/java/com/iterable/iterableapi/IterableActivityMonitor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import androidx.annotation.NonNull;
1111
import androidx.annotation.Nullable;
1212

13+
import com.iterable.iterableapi.util.BrandUtils;
14+
1315
import java.lang.ref.WeakReference;
1416
import java.util.ArrayList;
1517
import java.util.Iterator;
@@ -57,10 +59,8 @@ public void onActivityStarted(Activity activity) {
5759
@Override
5860
public void onActivityResumed(Activity activity) {
5961
currentActivity = new WeakReference<>(activity);
60-
String amazonFireTvHardware = "amazon.hardware.fire_tv";
61-
String amazonModel = Build.MODEL;
6262

63-
if (!inForeground || amazonModel.matches("AFTN") || activity.getPackageManager().hasSystemFeature(amazonFireTvHardware)) {
63+
if (!inForeground || BrandUtils.isFireTV(activity.getPackageManager())) {
6464
inForeground = true;
6565
for (WeakReference<AppStateCallback> callback : callbacks) {
6666
if (callback.get() != null) {

iterableapi/src/main/java/com/iterable/iterableapi/IterableApiClient.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import androidx.annotation.Nullable;
88
import androidx.core.app.NotificationManagerCompat;
99

10+
import com.iterable.iterableapi.util.BrandUtils;
11+
1012
import org.json.JSONArray;
1113
import org.json.JSONException;
1214
import org.json.JSONObject;
@@ -204,7 +206,7 @@ public void getInAppMessages(int count, @NonNull IterableHelper.IterableActionHa
204206
try {
205207
addEmailOrUserIdToJson(requestJSON);
206208
requestJSON.put(IterableConstants.ITERABLE_IN_APP_COUNT, count);
207-
requestJSON.put(IterableConstants.KEY_PLATFORM, IterableConstants.ITBL_PLATFORM_ANDROID);
209+
requestJSON.put(IterableConstants.KEY_PLATFORM, BrandUtils.isFireTV(authProvider.getContext().getPackageManager()) ? IterableConstants.ITBL_PLATFORM_OTT : IterableConstants.ITBL_PLATFORM_ANDROID);
208210
requestJSON.put(IterableConstants.ITBL_KEY_SDK_VERSION, IterableConstants.ITBL_KEY_SDK_VERSION_NUMBER);
209211
requestJSON.put(IterableConstants.ITBL_SYSTEM_VERSION, Build.VERSION.RELEASE);
210212
requestJSON.put(IterableConstants.KEY_PACKAGE_NAME, authProvider.getContext().getPackageName());

iterableapi/src/main/java/com/iterable/iterableapi/IterableConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ public final class IterableConstants {
245245

246246
public static final String ITBL_KEY_SDK_VERSION = "SDKVersion";
247247
public static final String ITBL_PLATFORM_ANDROID = "Android";
248+
public static final String ITBL_PLATFORM_OTT = "OTT";
248249
public static final String ITBL_KEY_SDK_VERSION_NUMBER = BuildConfig.ITERABLE_SDK_VERSION;
249250
public static final String ITBL_SYSTEM_VERSION = "systemVersion";
250251

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.iterable.iterableapi.util;
2+
3+
import android.app.Activity;
4+
import android.content.pm.PackageManager;
5+
import android.os.Build;
6+
7+
public final class BrandUtils {
8+
9+
private BrandUtils() {
10+
}
11+
12+
public static boolean isFireTV(PackageManager packageManager) {
13+
String amazonFireTvHardware = "amazon.hardware.fire_tv";
14+
String amazonModel = Build.MODEL;
15+
if (amazonModel.matches("AFTN") || packageManager.hasSystemFeature(amazonFireTvHardware)) {
16+
return true;
17+
} else {
18+
return false;
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)