❗ While I do not have the time to actively maintain RN-hockeyapp anymore, I am open to new maintainers taking the lead. If you would be interested, contact me at ladislav (at) benloop (dot) com. ❗
HockeyApp integration for React Native.
- iOS 7+
- Android
- React Native >0.17
- CocoaPods
npm install react-native-hockeyapp --saveYou will need:
CocoaPods (Setup)
Add to your ios/Podfile:
pod"HockeySDK"Run pod install
Open YourProject.xcworkspace
- Drag-and-drop
RNHockeyApp.xcodeprojfrom./node_modules/react-native-hockeyapp/RNHockeyAppinto yourProject > Libraries. - Drag-and-drop
libRNHockeyApp.afromLibraries/RNHockeyApp/ProductsintoLinked Frameworks and Libraries
If you wish to use Device UUID authentication or Web authentication, the following must be added to ios/AppDelegate.m
#import"RNHockeyApp.h"
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
if( [[BITHockeyManager sharedHockeyManager].authenticator handleOpenURL:url
sourceApplication:sourceApplication
annotation:annotation]) {
returnYES;
}
/* Your own custom URL handlers */returnNO;
}You also need to add RNHockeyApp to Build Settings > Search Paths > Header Search Paths as a recursive search path, adding the following to both Debug and Release and ensuring recursive is selected (double click each line as opposed to editing it as text, and you'll see the dropdowns):
$(SRCROOT)/../node_modules/react-native-hockeyapp/RNHockeyApp
- In
android/setting.gradle
...
include ':react-native-hockeyapp', ':app'
project(':react-native-hockeyapp').projectDir =newFile(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:4.1.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.29.+"
compile project(":react-native-hockeyapp") // <--- add this
}- Manifest file
<application ..>
<activityandroid:name="net.hockeyapp.android.UpdateActivity" />
<activityandroid:name="net.hockeyapp.android.FeedbackActivity" />
</application>- Register Module (in MainApplication.java)
importcom.slowpath.hockeyapp.RNHockeyAppModule; // <--- importimportcom.slowpath.hockeyapp.RNHockeyAppPackage; // <--- importpublicclassMainApplicationextendsApplicationimplementsReactApplication {
......
@OverrideprotectedList<ReactPackage> getPackages() {
returnArrays.<ReactPackage>asList(
newRNHockeyAppPackage(MainApplication.this), // <------ add this line to yout MainApplication classnewMainReactPackage());
}
......
}- In
android/setting.gradle
...
include ':react-native-hockeyapp', ':app'
project(':react-native-hockeyapp').projectDir =newFile(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:4.1.2'// <--- 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
<application ..>
<activityandroid:name="net.hockeyapp.android.UpdateActivity" />
<activityandroid:name="net.hockeyapp.android.FeedbackActivity" />
</application>- Register Module (in MainActivity.java)
importcom.slowpath.hockeyapp.RNHockeyAppModule; // <--- importimportcom.slowpath.hockeyapp.RNHockeyAppPackage; // <--- importpublicclassMainActivityextendsReactActivity {
......
@OverrideprotectedList<ReactPackage> getPackages() {
returnArrays.<ReactPackage>asList(
newRNHockeyAppPackage(this), // <------ add this line to yout MainActivity classnewMainReactPackage());
}
......
}From your JS files for both iOS and Android:
varHockeyApp=require('react-native-hockeyapp');componentWillMount(){HockeyApp.configure(HOCKEY_APP_ID,true);}componentDidMount(){HockeyApp.start();HockeyApp.checkForUpdate();// optional}You have available these methods:
HockeyApp.configure(HockeyAppId: string,autoSendCrashReports: boolean=true,authenticationType: AuthenticationType=AuthenticationType.Anonymous,appSecret: string='',ignoreDefaultHandler: string=false);// Configure the settingsHockeyApp.start();// Start the HockeyApp integrationHockeyApp.checkForUpdate();// Check if there's new version and if so trigger updateHockeyApp.feedback();// Ask user for feedback.HockeyApp.addMetadata(metadata: object);// Add metadata to crash report. The argument must be an object with key-value pairs.HockeyApp.generateTestCrash();// Generate test crash. Only works in no-debug mode.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)
See https://github.com/slowpath/react-native-hockeyapp/graphs/contributors