Configuration

The simplest way to initialize Malwarelytics for Android is in Application.onCreate() system callback. The absolute minimum required for integration is to provide apiUsername, apiPassword and apiSignaturePublicKey in AppProtectionConfig.Builder.

You can find API_USERNAME, API_PASSWORD and API_SIGNATURE_PUBLIC_KEY values in the Malwarelytics console. Use some user identifier you understand for INTERNAL_CLIENT_ID. To obtain the SIGNATURE_HASH value, please follow the Repackaging Detection guide.

An example of minimal initialization code:

class MyApplication : Application() {

    override fun onCreate() {
        // Prepare minimal configuration
        val config = AppProtectionConfig.Builder(appContext)
            .apiUsername(API_USERNAME)
            .apiPassword(API_PASSWORD)
            .apiSignaturePublicKey(API_SIGNATURE_PUBLIC_KEY)
            .clientAppUserId(INTERNAL_CLIENT_ID) // Use if the internal user ID is available at config time
            .antivirusConfig(
                AntivirusConfig.Builder()
                        .build()
            )
            .raspConfig(
                RaspConfig.Builder()
                        .signatureHash(SIGNATURE_HASH)
                        .build()
            )
            .build()

        // Initialize AppProtection class
        val appProtection = AppProtection.getInstance()
        appProtection.initializeAsync(config, object: AppProtection.InitializationObserver {
            // App Protection is fully ready to be used now
            override fun onInitialized() {
                // Setup internal user ID if you are able to obtain it
                appProtection.updateClientAppUserId(INTERNAL_CLIENT_ID)
            }
        })   
        // ...           
    }
}

See RASP feature overview for a detailed documentation of available detections and security features.

Last updated on May 27, 2021 (12:42) View product
Search

0.15.x

Malwarelytics for Android