Optional Module: Crash Reporter

Optional Module: Crash Reporter

by ‎03-22-2018 09:05 AM - edited ‎03-22-2018 09:05 AM (186 Views)

This is a separate, optional plugin that provides a Cordova wrapper for the native Android Crash Reporter module. iOS is not currently supported, but may be in a future release.

Installation

  1. Navigate to your cordova app's directory in a terminal window, and enter cordova plugin add tealium-cordova-crashreporter.
  2. No explicit initialization of this module is required; it is instantiated by the core Tealium plugin if the isCrashReporterEnabled parameter is set in the config object. Example:
function tealiumInit(accountName, profileName, environmentName, instanceName){
        tealium.init({
                 account : accountName       
                 , profile : profileName
                 , environment : environmentName                          
                 , instance : instanceName 
					 , isLifecycleEnabled: "true" 
                 , collectDispatchProfile:"cordova-demo"
                 , isCrashReporterEnabled: "true" // enable crash reporting (uncaught exception handler)
                 });
}

Testing

The JavaScript API exposes a method to force a crash to be triggered. In order to avoid accidental triggering of a crash in production, this method is hard-coded to work only if the following conditions are met:

  • The environment is set to dev
  • Crash Reporter module is installed
  • Crash Reporter module was successfully initialized.
  • The variable forceCrash is present in the data layer

If the above conditions are met, you may trigger a crash by issuing a tracking call containing the variable forceCrash. Example:

tealium.trackView({"forceCrash":"true"});

Removal

To remove the Ad Identifier plugin, run cordova plugin rm tealium-cordova-crashreporter.

Also be sure to remove the isCrashReporterEnabled flag from the config object when initializing the main Tealium plugin.