Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.iterable.iterableapi.util.BrandUtils;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;
Expand Down Expand Up @@ -57,10 +59,8 @@ public void onActivityStarted(Activity activity) {
@Override
public void onActivityResumed(Activity activity) {
currentActivity = new WeakReference<>(activity);
String amazonFireTvHardware = "amazon.hardware.fire_tv";
String amazonModel = Build.MODEL;

if (!inForeground || amazonModel.matches("AFTN") || activity.getPackageManager().hasSystemFeature(amazonFireTvHardware)) {
if (!inForeground || BrandUtils.isFireTV(activity.getPackageManager())) {
inForeground = true;
for (WeakReference<AppStateCallback> callback : callbacks) {
if (callback.get() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import androidx.annotation.Nullable;
import androidx.core.app.NotificationManagerCompat;

import com.iterable.iterableapi.util.BrandUtils;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
Expand Down Expand Up @@ -204,7 +206,7 @@ public void getInAppMessages(int count, @NonNull IterableHelper.IterableActionHa
try {
addEmailOrUserIdToJson(requestJSON);
requestJSON.put(IterableConstants.ITERABLE_IN_APP_COUNT, count);
requestJSON.put(IterableConstants.KEY_PLATFORM, IterableConstants.ITBL_PLATFORM_ANDROID);
requestJSON.put(IterableConstants.KEY_PLATFORM, BrandUtils.isFireTV(authProvider.getContext().getPackageManager()) ? IterableConstants.ITBL_PLATFORM_OTT : IterableConstants.ITBL_PLATFORM_ANDROID);
requestJSON.put(IterableConstants.ITBL_KEY_SDK_VERSION, IterableConstants.ITBL_KEY_SDK_VERSION_NUMBER);
requestJSON.put(IterableConstants.ITBL_SYSTEM_VERSION, Build.VERSION.RELEASE);
requestJSON.put(IterableConstants.KEY_PACKAGE_NAME, authProvider.getContext().getPackageName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ public final class IterableConstants {

public static final String ITBL_KEY_SDK_VERSION = "SDKVersion";
public static final String ITBL_PLATFORM_ANDROID = "Android";
public static final String ITBL_PLATFORM_OTT = "OTT";
public static final String ITBL_KEY_SDK_VERSION_NUMBER = BuildConfig.ITERABLE_SDK_VERSION;
public static final String ITBL_SYSTEM_VERSION = "systemVersion";

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.iterable.iterableapi.util;

import android.app.Activity;
import android.content.pm.PackageManager;
import android.os.Build;

public final class BrandUtils {

private BrandUtils() {
}

public static boolean isFireTV(PackageManager packageManager) {
String amazonFireTvHardware = "amazon.hardware.fire_tv";
String amazonModel = Build.MODEL;
if (amazonModel.matches("AFTN") || packageManager.hasSystemFeature(amazonFireTvHardware)) {
return true;
} else {
return false;
}
}
}