-
Make sure that you have Node and Cordova CLI or PhoneGap's CLI installed on your machine.
-
(Important) Add Fabric SDK to the Android / iOS project Fabric.io
-
Follow the steps to setup the SDK in your project.
-
Add a plugin to your project using Cordova CLI:
cordova plugin add https://github.com/sarriaroman/FabricPlugin
Or using PhoneGap CLI:
phonegap local plugin add https://github.com/sarriaroman/FabricPlugin
- Core
This module is intended to contain the core and generic features
window.fabric.core
- Answers
This module contains the Crashlytics Answers API. This is not yet complete but has all the mayor features
window.fabric.Answers
- Crashlytics
This module has the Crashlytics features
window.fabric.Crashlytics
// Register a successful login
window.fabric.Answers.sendLogIn();
Sends a login event
Sends a SignUp event
Sends a Content View event with the parameters:
- Name: name of View
- type: Type of View
- id: the ID of the View
- attributes: Object containing extra attributes to be set in the event ( Must be an Object )
Sends a Content View with Screen parameter in the type. Required parameters:
- Name: name of View
- id: the ID of the View
- attributes: Object containing extra attributes to be set in the event ( Must be an Object )
Sends a Custom Event. Required parameters:
- Name: name of View
- attributes: Object containing custom information to be set in the event ( Must be an Object )
function sendCrashWithData() {
window.fabric.Crashlytics.setUserIdentifier('TheIdentifier');
window.fabric.Crashlytics.setUserName('My Name');
window.fabric.Crashlytics.setUserEmail('[email protected]');
window.fabric.Crashlytics.setStringValueForKey('MyString', 'stringkey');
window.fabric.Crashlytics.setIntValueForKey(200, 'intkey');
window.fabric.Crashlytics.setBoolValueForKey(true, 'boolkey');
window.fabric.Crashlytics.setFloatValueForKey(1.5, 'floatkey');
window.fabric.Crashlytics.addLog('This my a log message from JS!');
window.fabric.Crashlytics.addLog('This is another log message from JS!');
window.fabric.Crashlytics.sendCrash();
}
Set the user identifier value
Set the username
Set the user email
Set String value for key
Set integer value for key
Set boolean for key
Set float for key
Add log for the crash.
Send a (fatal) crash to the backand of CrashLytics.
- Javascript code moved to ES6
- Separated in modules
- Full support for both OSs with same API
- Implement missing events from Answers API
- Move to the entire Fabric API instead of Just Crashlytics
- Román A. Sarria
- Based on Crashlytics plugin: https://github.com/francescobitmunks/cordova-plugin-crashlytics