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.

An example of minimum initialization code:

class MyApplication : Application() {

    override fun onCreate() {
        // Prepare minimum 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)
            }
        })   
        // ...           
    }
}

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.

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

Last updated on Jul 21, 2021 (14:15) View product
Search

0.16.x

Malwarelytics for Android