Skip to content

Commit

Permalink
check api level and instant app
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredmixpanel committed Sep 23, 2024
1 parent a661a10 commit 74ccc64
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/main/java/com/mixpanel/android/mpmetrics/MixpanelAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,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
);
}
}

/**
Expand Down

0 comments on commit 74ccc64

Please sign in to comment.