Android

Install SDK in Cordova Environment

1. Installing Gradle plugin

In the “app.gradle” file, add “imqa-mpm-injector” to the “dependencies” block in the "buildscript" followed by “plugin” at the top. This is typically located in “<project_dir>/app/build.gradle”.

app.gradle(project root)
// Add Build script dependencies 
buildscript { 
    repositories { 
        mavenCentral()
    } 
    
    dependencies {
    // Add dependencies.
        classpath 'io.imqa:imqa-mpm-injector:2.25.6' ... 
    } 
} 
  • java

app.gradle(app module) -> java
...
    dependencies {
    // Add dependencies.
       implementation 'io.imqa:imqa-core:2.27.5'
       implementation 'io.imqa:imqa-mpm-client:2.27.9'
       implementation 'io.imqa:imqa-crash-client:2.27.5'
    } 
} 

io.imqa.IMQAPlugin imqaPlugin = new io.imqa.IMQAPlugin()
imqaPlugin.init(project)
new io.imqa.injector.GJavacAction(project.name).setConfiguration(project)
android.applicationVariants.all { variant ->
    variant.javaCompile.doLast { task ->
        new io.imqa.injector.CompileAction(
                io.imqa.injector.util.BuildOption.BUILD_LOCATION_TYPE.javacClasses,
                project.name,
                io.imqa.injector.GJavacAction.convertBuildType(variant.getBuildType()),
                io.imqa.injector.GJavacAction.makeFlavor(variant.getBuildType().name,
                        variant)
        ).execute(task)
    }
}
  • kotlin

  • java + kotlin

2. Adding authority to the Android Manifest

You have to grant Internet authority to upload occurred crash information to AndroidManifest.xml.

3. Setting Cordova Library

3.1. WebView HTTP request

Setting the web server

If you want to collect WebView data, you need to embed the IMQA WebView JavaScript library into a web page that supports WebView. You can download the file and serve it directly from your web server. (We recommend importing it directly to avoid CORS issues.)

Gradle( build.gradle ) Set up

You need to add IMQA SDK so that the IMQA code can be declared inside the Cordova library.

Android Agent Setup

MPM collects pages and requests related to WebView. To enable the collection, you need to set up options and add MPMWebviewInterface.

Last updated