diff --git a/src/main/java/com/mixpanel/android/mpmetrics/MixpanelAPI.java b/src/main/java/com/mixpanel/android/mpmetrics/MixpanelAPI.java index 2e0321b9..a603955c 100644 --- a/src/main/java/com/mixpanel/android/mpmetrics/MixpanelAPI.java +++ b/src/main/java/com/mixpanel/android/mpmetrics/MixpanelAPI.java @@ -14,7 +14,6 @@ import android.os.Bundle; import androidx.core.content.ContextCompat; -import com.mixpanel.android.util.MPConstants.SessionReplay; import com.mixpanel.android.util.MPLog; import com.mixpanel.android.util.ProxyServerInteractor; @@ -195,13 +194,17 @@ public class MixpanelAPI { mMessages.removeResidualImageFiles(new File(mContext.getApplicationInfo().dataDir)); } - BroadcastReceiver sessionReplayReceiver = new SessionReplayBroadcastReceiver(this); - ContextCompat.registerReceiver( - mContext.getApplicationContext(), - sessionReplayReceiver, - SessionReplayBroadcastReceiver.INTENT_FILTER, - ContextCompat.RECEIVER_NOT_EXPORTED - ); + // Event tracking integration w/ Session Replay SDK requires Android 13 or higher. + // It is also NOT supported in "Instant" apps + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && !context.getPackageManager().isInstantApp()) { + BroadcastReceiver sessionReplayReceiver = new SessionReplayBroadcastReceiver(this); + ContextCompat.registerReceiver( + mContext.getApplicationContext(), + sessionReplayReceiver, + SessionReplayBroadcastReceiver.INTENT_FILTER, + ContextCompat.RECEIVER_NOT_EXPORTED + ); + } } /**