Skip to main content

Android

Add the MPS.aar to your project libs folder and in build.gradle:

android {
...
packagingOptions {
jniLibs {
useLegacyPackaging = true
}
}
...
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.aar'])
...
}


MPS can then be used to test for a rooted device, the app being run in an emulator and retrive an endpoint securely stored within the library:

import com.securityside.mobileprotection.Hardening;
import com.securityside.mobileprotection.Secrets;

import android.content.Context;

...

Context ctx; // getApplicationContext() / getActivity()

try {

Hardening mps = Hardening.getInstance(ctx);
} catch (Exception e) {
...
}

String secret = Secrets.<Secret Name>();
boolean rooted = mps.isRooted();
boolean emulator = mps.isEmulator();

MPS can be configured to automatically quit the app on any failed required validations, such as running on a rooted device/emulator, detecting other tampering tools, alternative application installation store, etc.; otherwise an attacker can still change the response returned by MPS to the main application and then bypass security mechanisms employed by the application.