react-native-hockeyapp
HockeyApp integration for React Native.
Requirements
- iOS 7+
- Android
- React Native >0.17
- CocoaPods
Installation
npm install hockeyapp-react-native --save
iOS
You will need:
CocoaPods (Setup)
Podfile
Add to your ios/Podfile
:
pod "HockeySDK"
Run pod install
Add Pods.xcodeproj to your project
Drag-and-drop ./ios/Pods/Pods.xcodeproj into your Project > Libraries.
Add the RNHockeyApp/ folder to your project
Drag-and-drop files from ./node_modules/react-native-hockeyapp/RNHockeyApp into your Project > Libraries.
Changes to AppDelegate.m
If you wish to use Device UUID authentication or Web authentication, the following must be added to ios/AppDelegate.m
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
Android (React Native >= 0.29)
Google project configuration
- In
android/setting.gradle
...include ':react-native-hockeyapp', ':app'project(':react-native-hockeyapp').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-hockeyapp/android')
- In
android/build.gradle
...repositories { jcenter() mavenCentral()}dependencies { classpath 'com.android.tools.build:gradle:....' classpath 'net.hockeyapp.android:HockeySDK:4.1.1' // <--- add this}
- In
android/app/build.gradle
apply plugin: "com.android.application"...dependencies { compile fileTree(dir: "libs", include: ["*.jar"]) compile "com.android.support:appcompat-v7:23.0.1" compile "com.facebook.react:react-native:0.29.+" compile project(":hockeyapp-react-native") // <--- add this}
- Manifest file
- Register Module (in MainApplication.java)
// <--- import // <--- import
Android (React Native 0.17 - 0.28)
Google project configuration
- In
android/setting.gradle
...include ':react-native-hockeyapp', ':app'project(':react-native-hockeyapp').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-hockeyapp/android')
- In
android/build.gradle
...repositories { jcenter() mavenCentral()}dependencies { classpath 'com.android.tools.build:gradle:1.3.1' classpath 'net.hockeyapp.android:HockeySDK:3.7.0' // <--- add this}
- In
android/app/build.gradle
apply plugin: "com.android.application"...dependencies { compile fileTree(dir: "libs", include: ["*.jar"]) compile "com.android.support:appcompat-v7:23.0.1" compile "com.facebook.react:react-native:0.17.+" compile project(":react-native-hockeyapp") // <--- add this}
- Manifest file
- Register Module (in MainActivity.java)
// <--- import // <--- import
Usage
From your JS files for both iOS and Android:
var HockeyApp = ; { HockeyApp;} { HockeyAppstart; HockeyApp;}
You have available these methods:
// Configure the settingsHockeyApp; HockeyAppstart; // Start the HockeyApp integration HockeyApp; // Check if there's new version and if so trigger update HockeyApp; // Ask user for feedback. HockeyApp; // Add metadata to crash report. The argument must be an object with key-value pairs. HockeyApp; // Generate test crash. Only works in no-debug mode. HockeyApp; // Send event metrics
The following authentication methods are available:
- AuthenticationType.Anonymous - Anonymous Authentication
- AuthenticationType.EmailSecret - HockeyApp email & App Secret
- AuthenticationType.EmailPassword - HockeyApp email & password
- AuthenticationType.DeviceUUID - HockeyApp registered device UUID
- AuthenticationType.Web - HockeyApp Web Auth (iOS only)
Contributions
See https://github.com/slowpath/react-native-hockeyapp/graphs/contributors