Skip to content

Commit d3bc472

Browse files
committed
Remove attempt at setFlushOnBackground for android
1 parent e889311 commit d3bc472

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

android/src/main/java/com/mixpanel/reactnative/MixpanelReactNativeModule.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,6 @@ public void setLoggingEnabled(final String token, boolean enableLogging, Promise
6767
}
6868
}
6969

70-
@ReactMethod
71-
public void setFlushOnBackground(final String token, boolean flushOnBackground, Promise promise) throws JSONException {
72-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
73-
synchronized (instance) {
74-
instance.setFlushOnBackground(flushOnBackground);
75-
promise.resolve(null);
76-
}
77-
}
78-
7970
@ReactMethod
8071
public void hasOptedOutTracking(final String token, Promise promise) {
8172
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);

index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,18 @@ export class Mixpanel {
107107
}
108108

109109
/**
110-
* This allows enabling or disabling whether or not Mixpanel flushes events.
111-
* when the app enters the background. This is set to true by default.
110+
* This allows enabling or disabling whether or not Mixpanel flushes events
111+
* when the app enters the background on iOS. This is set to true by default.
112112
*
113113
* @param {boolean} flushOnBackground whether to enable logging
114114
*
115115
*/
116116
setFlushOnBackground(flushOnBackground) {
117-
MixpanelReactNative.setFlushOnBackground(this.token, flushOnBackground);
117+
if (Platform.OS === 'ios') {
118+
MixpanelReactNative.setFlushOnBackground(this.token, flushOnBackground);
119+
} else {
120+
console.warn('Mixpanel setFlushOnBackground was called and ignored because this method only works on iOS.')
121+
}
118122
}
119123

120124
/**

0 commit comments

Comments
 (0)