Closed CubeSugar closed 5 years ago
index.js
, where current Activity is available.One solution is, if current Activity is available, then use it, otherwise use Application context.
After investigated Flurry's lifecycle, the above solution should work consistent with.
We will include this fix in the next release.
@poting-oath That sounds great!
@CubeSugar We just released new version 2.1.0 that contains this fix. Thanks a lot for your great feedback!
Current Behavior (using js)
case 1: crash
By using
getCurrentActivity
method to initialize Flurry Sdk, app may crash in some rare situations. I can't reproduce in development.The
getCurrentActivity
sometimes returns null. Some stacktrace like below:FYI: #https://github.com/facebook/react-native/issues/18345
case 2: flurry session
Using
getReactApplicationContext
as context to initialiaze SDK will prevent app crash, butSee: #3
Best Practices (native codes)
Prefer to use only native codes ( like java / Objective-C ) rather than js to initialize Flurry SDK. See Doc#Initialize Flurry