A Google Firebase Crashlytics plugin to enable capture of crash reports.
From the Google documentation (https://firebase.google.com/products/crashlytics/):
Firebase Crashlytics helps you track, prioritize, and fix stability issues that erode app quality, in realtime. Spend less time triaging and troubleshooting crashes and more time building app features that delight users
This plugin supports the following platforms:
- Android
- iOS (untested)
- Browser (for testing only)
cordova plugin add cordova-plugin-firebase-crashlytics --variable ANDROID_FIREBASE_CORE_VERSION=16.0.0 --save
or
phonegap plugin add cordova-plugin-firebase-crashlytics --variable ANDROID_FIREBASE_CORE_VERSION=16.0.0
Omitting FIREBASE_VERSION
will use a default value.
You must ensure that google-services.json
is put in the correct location. This can be achieved using the following in your config.xml
:
<platform name="android">
<resource-file src="google-services.json" target="google-services.json" />
</platform>
In order to ensure Firebase initialises correctly on Android this plugin can be used. This is not automatically added as a dependency to allow for the configuration it performs to be done manually if desired.
iOS requires GoogleService-Info.plist
is put in the correct location. Similarly this can be done as follows:
<platform name="ios">
<resource-file src="GoogleService-Info.plist" />
</platform>
At this time it is necessary to manually add the use_frameworks!
directive to this file.
If using multiple Firebase plugins it may be necessary to enable this.
Simply add the plugin to get the default Crashlytics functionality. Note that crashes and logged exceptions will only be reported when the application restarts.
In order to log caught exceptions the following can be used:
var crashlytics = FirebaseCrashlytics.initialise();
crashlytics.logException("my caught exception");
Generate a forced crash. Visible in console after restart of application.
Log a priority message. Will only be logged in the event of a crash.
Available priorities are compatible with most Android Log constants:
- FirebaseCrashlytics.LOG.VERBOSE
- FirebaseCrashlytics.LOG.DEBUG
- FirebaseCrashlytics.LOG.INFO
- FirebaseCrashlytics.LOG.WARN
- FirebaseCrashlytics.LOG.ERROR
Example usage
crashlytics.logPriority(FirebaseCrashlytics.LOG.WARN, 'dashboard', 'This should not happened')
Log a message. Will only be logged in the event of a crash.
Log when a handled exception has happened. Visible in console after restart of application.
Set extra key/value string value. Will only be logged in the event of a crash.
Set extra key/value bool value. Will only be logged in the event of a crash.
Set extra key/value double value. Will only be logged in the event of a crash.
Set extra key/value float value. Will only be logged in the event of a crash.
Set extra key/value integer value. Will only be logged in the event of a crash.
Set the identifier for the user. Take care when using this method and ensure you privacy policy is updated accordingly.
- Dependency updates
- Addition of log priority constants
- Update Android Firebase dependency
- Fix podspec for cordova-ios 5
- Fix xcode issue
- Remove podspec version for firebase
- Update Android dependency versions
- Update iOS dependency versions
- Update plugin dependencies
- WARNING: The Android update may require you to update com.google.gms:google-services to 4.0.0, com.android.tools.build:gradle to 3.1.2 and gradle to 4.4.4 (look in platforms/android/cordova/lib/builders/GradleBuilder.js)
- Add SetUserIdentifier()
- Fix iOS set() methods with wrong types
- Merge back in some iOS updates (https://github.com/kanodeveloper/cordova-plugin-firebase-crashlytics-ka)
- Add xcode npm dependency
- Updated gradle dependencies
- Fix typo in README
- Added embarrassing fix for logException()
- Add grunt to run jshint
- Fix some grunt warnings
- Initial release