ionic cordova plugin add instabug-cordova@8.0.4
2.1) Open YOUR_PROJECT/platforms/android/AndroidManifest.xml
Find the application
tag and add the android:name
attribute value with com.instabug.cordova.plugin.MyApplication
<application
android:hardwareAccelerated="true"
android:icon="@mipmap/icon"
android:label="@string/app_name"
android:name="com.instabug.cordova.plugin.MyApplication"
android:supportsRtl="true">
2.2) Add the API key to the MyApplication file located at {project_root}/platforms/android/src/com/instabug/cordova/plugin/MyApplication.java
new Instabug.Builder(
this,
"INSTABUG_TOKEN",
InstabugInvocationEvent.SHAKE
).build();
3.1) Declare a variable called cordova, just below your import statements and above your @Component decorator.
import { Component, ViewChild } from '@angular/core';
import { Nav, Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
...
declare var cordova: any;
@Component({
templateUrl: 'app.html'
})
export class MyApp {
3.2) In app.components.ts
, activate the Instabug plugin, put the following code inside constructor()
this.platform.ready().then(() => {
cordova.plugins.instabug.activate(
{
ios: "INSTABUG_TOKEN"
},
"shake",
{
commentRequired: true,
colorTheme: "dark"
},
function () {
console.log("Instabug initialized.");
},
function (error) {
console.log("Instabug could not be initialized - " + error);
}
);
});