Getting Started With Malwarelytics
Project Configuration
To use Malwarelytics SDK it’s necessary to add maven repository and dependency to the project.
Adding Maven Repository
Add new maven repository pointing to local path of the Wultra App Protection SDK dependency.
repositories {
maven {
url "${PATH_TO_WULTRA_APP_PROTECTION_PACKAGE}/maven"
}
}
Adding Project Dependency
Once the maven repository is added, app protection dependency can be added to the Android project.
android {
dependencies {
implementation "com.wultra.android.antimalware:antivirus:${WULTRA_APP_PROTECTION_VERSION}"
}
}
Initialization
The simplest way to initialize App Protection SDK 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 minimal initialization code:
class MyApplication : Application() {
override fun onCreate() {
// ...
val config = AppProtectionConfig.Builder(appContext)
.antivirusConfig(
AntivirusConfig.Builder()
.apiUsername(API_USERNAME)
.apiPassword(API_PASSWORD)
.apiSignaturePublicKey(API_SIGNATURE_PUBLIC_KEY)
.build()
)
.raspConfig(
RaspConfig.Builder()
.build()
)
.build()
val appProtection = AppProtection.getInstance()
appProtection.initializeAsync(config, object : AppProtection.InitializationObserver {
override fun onInitialized() {
// App Protection is fully ready to be used now
// setup your internal user identifier when you are able to obtain it
appProtection.updateClientAppUserId(CLIENT_ID)
}
})
// ...
}
}
Customizing UI
UI parts of the antivirus part of the App Protection SDK can be customized in initialization
through setting ThreatMitigationUIConfig
in AntivirusConfig.Builder
:
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()
// ...
.setThreatMitigationUIConfig(threatMitigationUIConfig)
.build()
In the case you configure UI and set it in the builder, the smart protection is automatically started. You do not need to call any methods to trigger scan - the SDK automatically monitors all app updates and display the appropriate UI whenever needed.
Further Customization of Default Behaviors
You can learn more about customizing the SDK behavior in the SDK’s README file which contains much more detailed information.