- Install package via npm:
npm install react-native-flurry-analytics --save
- Link native part
react-native link react-native-flurry-analytics
- Inside your code include JS part by adding
import FlurryAnalytics from 'react-native-flurry-analytics';
sudo gem install cocoapods
cd ios
pod init
open Podfile
Add this line
pod 'Flurry-iOS-SDK/FlurrySDK'
Then run
pod install
Add these lines in AndroidManifest.xml
<!-- Required permissions - Internet access -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<!-- Recommended permission - External memory pre-caching -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Add following to android/app/proguard-rules.pro
# Required to preserve the Flurry SDK
-keep class com.flurry.** { *; }
-dontwarn com.flurry.**
-keepattributes *Annotation*,EnclosingMethod,Signature
-keepclasseswithmembers class * {
public (android.content.Context, android.util.AttributeSet, int);
}
# Google Play Services library
-keep class * extends java.util.ListResourceBundle {
protected Object[ ][ ] getContents();
}
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}
FlurryAnalytics.startSession('YOUR_API_KEY');
!!! method must be called prior to invoking startSession
FlurryAnalytics.setAppVersion('1.0.0');
!!! method must be called prior to invoking startSession
FlurryAnalytics.setDebugLogEnabled(false)
!!! method must be called prior to invoking startSession
FlurryAnalytics.setSessionContinueSeconds(10);
!!! method must be called prior to invoking startSession
FlurryAnalytics.setCrashReportingEnabled(true);
FlurryAnalytics.logEvent('eventName');
FlurryAnalytics.logEvent('eventName', true);
FlurryAnalytics.logEvent('eventName', {param: 'true'});
FlurryAnalytics.logEvent('eventName', {param: 'true'}, true);
FlurryAnalytics.endTimedEvent('eventName');
FlurryAnalytics.endTimedEvent('eventName', {param: 'true'});
FlurryAnalytics.logPageView();
FlurryAnalytics.setUserId('userId');
FlurryAnalytics.setUserAge(28);
FlurryAnalytics.setUserGender('m');
// or
FlurryAnalytics.setUserGender('f');
Just submit a pull request!
Code and documentation copyright 2016 Dmitriy Kolesnikov. Code released under the MIT license.