Listening to App Changes
An observer of app changes can be registered by the app integrating Malwarelytics for Android.
The observer notifies the app about these changes:
- A new app has been installed.
- An app has been updated.
- An app has been uninstalled.
The exact functionality of the listener differs slightly based on the Android version the device is running. Older versions of Android allow spotting an app change and delivering an observer callback immediately. On newer versions of Android, the callbacks are delivered with some delay.
The install
and update
callbacks deliver analyzed threat information. The uninstall
callback cannot provide such details since the app has already been uninstalled; only the package name is therefore provided in such case.
Registering App Observer
When Smart Protection is enabled, apps are observed automatically. However, the SDK also offers a way to observe changes explicitly by registering an ApkThreatObserver
. When it is no longer needed, it can be unregistered again.
antivirus.registerApkThreatObserver(threatObserver)
antivirus.unregisterApkThreatObserver(threatObserver)