Skip to content
Merged
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
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+"
// Stable native SDK (main branch). 3.1.0 adds startRecording/stopRecording/isRecording.
implementation 'io.github.middleware-labs:android-sdk:3.1.5'
implementation 'io.github.middleware-labs:android-sdk:3.1.6'
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.0.4"
// Compile-visible OTel for the JS-span reconstruction (SpanData etc.);
// runtime classes come transitively from android-sdk. Keep aligned with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static io.middleware.android.sdk.utils.Constants.LOG_TAG;

import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.util.Log;
Expand Down Expand Up @@ -163,7 +164,14 @@ public void initialize(ReadableMap configMap, Promise promise) {
UiThreadUtil.runOnUiThread(() -> {
try {
// v3 session recording starts inside build() (sampler-gated); no explicit start needed.
builder.build((Application) getReactApplicationContext().getApplicationContext());
// JS calls this after the host Activity has already resumed, so the recorder
// never sees the onActivityResumed it attaches on; given only the Application
// it would capture nothing until the app is backgrounded and reopened. Passing
// the Activity seeds the recorder's current activity.
Activity activity = getReactApplicationContext().getCurrentActivity();
builder.build(activity != null
? activity
: (Application) getReactApplicationContext().getApplicationContext());

// Link the JS-owned session immediately — before the v3 recorder captures
// its first frame — so no native telemetry lands under the native
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@middleware.io/middleware-react-native",
"version": "2.1.8",
"version": "2.1.9",
"description": "Middleware React Native real user monitoring SDK",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
Loading