Coder Social home page Coder Social logo

rubythonode / react-native-firebase-crash-report Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ianlin/react-native-firebase-crash-report

0.0 1.0 0.0 478 KB

React Native Firebase Crash Report With Custom Log

License: ISC License

Java 55.50% JavaScript 19.84% Objective-C 24.66%

react-native-firebase-crash-report's Introduction

React Native Firebase Crash Report

npm version npm downloads

React Native Firebase Crash Report With Custom Log

Version

If you're using React Native >= 0.40, make sure to use react-native-firebase-crash-report >= 1.2.0

Usage

import FirebaseCrash from 'react-native-firebase-crash-report';

/*
 * Create custom log messages that will be included in the crash report
 */

FirebaseCrash.log('User logged in');

/*
 * Create custom log messages that will be included in the crash report and output to logcat/NSLog
 */

FirebaseCrash.logcat('User logged in');

// Android only
// Params:
// - message: string, required
// - debug level: int, optional, default 3 (https://developer.android.com/reference/android/util/Log.html)
// - tag: string, optional, default 'RNFirebaseCrashReport'
FirebaseCrash.logcat('User logged in', 3, 'MyTag');

/*
 * Android only
 * Report errors on demand
 */

FirebaseCrash.report('A weird thing just happened...');

Installation

  • Install node module
npm install --save react-native-firebase-crash-report
  • Linking libraries
rnpm link react-native-firebase-crash-report

iOS Configuration

Install Firebase From Cocoapods

For more information please visit Set Up Crash Reporting For iOS

Pre-check

If you are using RN < 0.29 you would have run into this problem, just follow the PR to fix it manually.

Go to your project's ios folder

cd <your_project>/ios

(Optional) Initialise Pod

Note: You can skip this step if you have pod initialised already.

pod init

Add pod 'Firebase/Core' and pod 'Firebase/Crash' to Podfile

 target 'YourProject' do
   # Uncomment this line if you're using Swift or would like to use dynamic frameworks
   use_frameworks!

   # Pods for YourProject
+  pod 'Firebase/Core'
+  pod 'Firebase/Crash'

   target 'YourProjectTests' do
     inherit! :search_paths
     # Pods for testing
   end

 end

Install Pods

pod install

Initialise Firebase

Add following code in your AppDelegate.m

 #import "AppDelegate.h"

 #import "RCTRootView.h"

+@import Firebase;

 @implementation AppDelegate

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
 {

   ...

   self.window.rootViewController = rootViewController;
   [self.window makeKeyAndVisible];
+
+  // Use Firebase library to configure APIs
+  [FIRApp configure];
+
   return YES;
 }

Android Configuration

For more information please visit Set Up Crash Reporting For Android

Upgrade Google Play Services and Google Repository

Upgrade Google Play Services and Google Repository

Add Google Services

  • In android/build.gradle
     dependencies {
         classpath 'com.android.tools.build:gradle:1.3.1'
         classpath 'de.undercouch:gradle-download-task:2.0.0'
+        classpath 'com.google.gms:google-services:3.0.0'
  • In android/app/build.gradle, add this line at the bottom of the file
apply plugin: 'com.google.gms.google-services'

Contributing

Any pull requests, issue reports and suggestion are highly welcome.

License

ISC License (functionality equivalent to MIT License)

react-native-firebase-crash-report's People

Contributors

ianlin avatar zxcpoiu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.