Skip to content

Commit 4fe0cf8

Browse files
fix-initialize-method-channel (#196)
1 parent 5a3212c commit 4fe0cf8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

android/src/main/java/com/mixpanel/mixpanel_flutter/MixpanelFlutterPlugin.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBindin
4747
// Store references for lazy initialization to avoid ANR during plugin registration
4848
this.flutterPluginBinding = flutterPluginBinding;
4949
this.context = flutterPluginBinding.getApplicationContext();
50+
51+
initializeMethodChannel();
5052
}
5153

5254
@Override
@@ -189,9 +191,6 @@ private void initializeMethodChannel() {
189191
}
190192

191193
private void handleInitialize(MethodCall call, Result result) {
192-
// Lazy initialization of MethodChannel to avoid ANR
193-
initializeMethodChannel();
194-
195194
final String token = call.argument("token");
196195
if (token == null) {
197196
throw new RuntimeException("Your Mixpanel Token was not set");

0 commit comments

Comments
 (0)