Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagegroovy
allprojects {
    repositories {
        mavenCentral()
        google()
        
        // Mobile Protect Maven Repository
        maven {
            credentials {
                // Leave the username as "MAVEN"
                username "MAVEN"
                password "INSERT_YOUR_KEY"
            }
            url "https://mobile-protect-repos.securetheorem.com/mobileprotect-android"
        }
    }
}

If you use Cordova Cordova’s default repositories.gradle setup, you will need to add our repository to all repositories.gradle files. There are usually three of these:

  • platforms/android/repositories.gradle

  • platforms/android/app/repositories.gradle

  • platforms/android/cordovaLib/repositories.gradle

Code Block
ext.repos = {
    google()
    mavenCentral()
    maven {
      credentials {
          //Leave the username as "MAVEN"
          username "MAVEN"
          password "INSERT_YOUR_KEY"
      }
      url "https://mobile-protect-repos.securetheorem.com/mobileprotect-android"
  }
}

...

Code Block
languagejava
MobileProtect.init(this, R.xml.mobileprotect);

If you don’t have an Application object, you need to create one and register it in AndroidManifest.xml

5. Optional: configuration for static obfuscation

You can enable Mobile Protect obfuscation in the project build.gradle with:

Code Block
MobileProtectPluginConfiguration { 
    enableObfuscation = true
}

If static obfuscation is enabled for a Cordova project then the following proguard rules must be added to your proguard-rules.pro file in order to prevent plugins from breaking:

...