Cordova

Rollbar SDK for Cordova

Add Rollbar-cordova to your Cordova projects to automatically capture and report errors in your applications.

Quick Start

  1. Add the plugin to your app.
cordova plugin add rollbar-cordova
  1. Add your Rollbar client token to the Android and iOS environments.

Add this meta-data element inside the <application> element in AndroidManifest.xml:

<meta-data android:name="com.rollbar.android.ACCESS_TOKEN" android:value="YOUR_CLIENT_TOKEN" />

Add this preference element inside the <widget> element in ./config.xml:

<preference name="RollbarClientToken" value="YOUR_CLIENT_TOKEN" />
  1. Initialize Rollbar.js in index.js:
        window.Rollbar = new rollbar({
            accessToken: "YOUR_CLIENT_TOKEN",
            captureUncaught: true,
            captureUnhandledRejections: true,
        })
  1. Build
cordova build ios

or

cordova build android

And you are ready to use Rollbar.

Content Security Policy

Rollbar-cordova works without making network requests in the Javascript environment, by allowing the native Android and iOS environments to handle all network requests. You will not need to modify your Content Security Policy (CSP) for Rollbar to work correctly.

Usage

Rollbar-cordova provides the full capabilities of each of the supported environments. See the Usage section for each of the SDKs to explore the different ways you can use Rollbar.