Smart Protection UI Customization

The Smart Protection feature has the following UI elements:

  • Threat screen that displays a list of dangerous apps
  • Notification about a dangerous app

These elements can be customized in the initial Malwarelytics configuration in the AppProtection class instance. To do so, set up ThreatMitigationUIConfig in the AntivirusConfig.Builder instance:

val threatMitigationUIConfig = AntivirusConfig.ThreatMitigationUIConfig.Builder()
    .notificationSmallIcon(R.drawable.my_notification_icon)
    .notificationChannelId("AV-CHANNEL")
    .screenDeleteIcon(R.drawable.custom_delete_icon)
    .screenSettingsIcon(R.drawable.custom_settings_icon)
    .screenTheme(R.style.CustomThreatScreenTheme)
    .customLocalization("cs")
    .build()

val antivirusConfig = AntivirusConfig.Builder()
    // other Anti-Malware configuration
    .threatMitigationUIConfig(threatMitigationUIConfig)
    .build()
Method Description
notificationSmallIcon(Int) defines small notification icon appearance. The ID of an Android resource pointing to the drawable should be passed as an argument.
notificationChannelId(String) defines the notification channel ID.
screenDeleteIcon(Int) defines drawable for the associated image button. The ID of an Android resource pointing to the drawable should be passed as an argument.
screenSettingsIcon(Int) defines drawable for the associated image button. The ID of an Android resource pointing to the drawable should be passed as an argument.
screenTheme(Int) defines theme that should be used. The ID of an Android resource pointing to a theme should be passed as an argument. The bulk of the threat screen appearance is determined via this method.
customLocalization(String) defines which locale should be used. A two-letter code representing the language, corresponding to the ISO 639-1 standard, should be passed as an argument. See more details below.

Changing Default Localization

Default string resources in an Android app can be written in any language. Malwarelytics for Android uses the English locale (“en-US”) by default. In order to change the default, the developer has to define which locale to use. For example, changing the default SDK localization to Czech requires the developer to set customLocalization("cs").

After SDK initialization, the localization can still be changed:

val smartProtectionManager = antivirus.getSmartProtectionManager()
smartProtectionManager.setCustomLocalization(languageCode)
Last updated on May 01, 2022 (23:05) View product
Search

0.19.x

Malwarelytics for Android