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 antivirus package:
repositories {
maven {
url "${PATH_TO_WULTRA_ANTIVIRUS_PACKAGE}/maven"
}
}
Adding Project Dependency
Once the maven repository is added, antivirus dependency can be added to the Android project.
android {
dependencies {
implementation "com.wultra.android.antimalware:antivirus:${WULTRA_ANTIVIRUS_VERSION}"
}
}
Initialization
The simplest way to initialize Antivirus SDK is in Application.onCreate()
system callback.
The absolute minimum required for integration is to provide apiUsername
, apiPassword
and apiSignaturePublicKey
in AntivirusConfig.Builder
.
An example of minimal initialization code:
class MyApplication : Application() {
override fun onCreate() {
// ...
val config = AntivirusConfig.Builder(appContext)
.apiUsername(API_USERNAME)
.apiPassword(API_PASSWORD)
.apiSignaturePublicKey(API_SIGNATURE_PUBLIC_KEY)
.build()
val antivirus = Antivirus.getInstance()
antivirus.initializeAsync(config, object : Antivirus.InitializationObserver {
override fun onInitialized() {
// AV is fully ready to be used now
// setup your internal user identifier when you are able to obtain it
antivirus.updateClientAppUserId(CLIENT_ID)
}
})
// ...
}
}
Customizing UI
UI parts of AV 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 config = AntivirusConfig.Builder(appContext)
// ...
.setThreatMitigationUIConfig(threatMitigationUIConfig)
.build()
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.