Coder Social home page Coder Social logo

orangeappsru / cordova-fabric-crashlytics-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vianneyniji/cordova-fabric-crashlytics-plugin

6.0 3.0 3.0 25.87 MB

Fabric Crashlytics plugin for Cordova apps

JavaScript 45.87% Shell 2.62% Java 31.91% Objective-C 19.59%

cordova-fabric-crashlytics-plugin's Introduction

org.apache.cordova.crashlytics

This plugin provides a bridge between javascript error handling and Fabric Crashlytics serverside client API.

Installation

cordova plugin add https://github.com/vianneyniji/cordova-fabric-crashlytics-plugin --variable CRASHLYTICS_API_SECRET=<YOUR CRASHLYTICS API SECRET HERE> --variable CRASHLYTICS_API_KEY=<YOUR CRASHLYTICS API KEY HERE>

Crashlytics

Plugins provides a navigator.crashlytics object with following methods :

  • logException(string) : Sends an exception (non fatal) to the Crashlytics backend (Android only)
  • log(string) : Sends a standard log message (non fatal) to the Crashlytics backend
  • log(errorLevel, tag, msg) (Android only)
  • setApplicationInstallationIdentifier(appInstId) (Android only)
  • setBool(key, value)
  • setDouble(key, value)
  • setFloat(key, value)
  • setInt(key, value)
  • setLong(key, value)
  • setString(key, value)
  • setUserEmail(email)
  • setUserIdentifier(userId)
  • setUserName(userName)
  • simulateCrash(): Simulates a crash

Supported platforms

  • Android
  • iOS

AngularJS integration

Use the following snippet to integrate the plugin in your AngularJS app gracefully :

var module = angular.module("my-module", []);

module.config(['$provide', function($provide) {
    $provide.decorator("$exceptionHandler", ['$delegate', function($delegate) {
        return function(exception, cause) {
            $delegate(exception, cause);

            // Decorating standard exception handling behaviour by sending exception to crashlytics plugin
            var message = exception.toString();
            // Here, I rely on stacktrace-js (http://www.stacktracejs.com/) to format exception stacktraces before
            // sending it to the native bridge
            var stacktrace = exception.stack.toLocaleString();
            navigator.crashlytics.logException("ERROR: "+message+", stacktrace: "+stacktrace);
        };
    }]);
}]);

cordova-fabric-crashlytics-plugin's People

Contributors

drmoriarty avatar etabard avatar fcamblor avatar smistry-toushay avatar vianneyniji avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.