React Native Module for Malwarelytics

Edit on Github Send Feedback 2023.03 - Current Release

npm license

How To Install The Plugin

1. Get Malwarelytics native SDK and credentials

The SDK and credentials can be found under the “Get The SDK” section in the Malwarelytics Console.

2. Install native SDK to your local maven repository

After retrieving the SDK, install its content to your local Maven Repository (usually inside ~/.m2/repository).

Dont forget to add your local maven repository into your gradle file if it’s not added yet:

repositories {
npm i react-native-malwarelytics --save
npx react-native link

4. Configure the SDK

In your apps build.gradle file (located in android/app/), apply gradle plugin with

apply from: "../../node_modules/react-native-malwarelytics/android/configure.gradle"

and then configure it your app credentials

android {
    defaultConfig {
        configureMalwarelytics owner, "USERNAME", "PASSWORD" //, "", "R.mipmap.ic_launcher"

Last two parameters are optional in initial setup and can be omitted.

  • third parameter is a resource reference to your theme. For more information on styling see Styling Threat Screen.
  • fourth parameter is a resource reference to an icon that will be displayed in Malwarelytics notifications. You can use to reuse your app icon.

PRO-TIP: You can configure the Malwarelytics for each flavor to provide different credentials for your testing environment.

5. Initialize and use the plugin

In your application, you can now import module with import Malwarelytics from 'react-native-malwarelytics';.

Initializing the module:

    .initialize({enableSilentMode: false})
    .then(function() {
    .catch(function(e) { 

Call the scan:

    .then(function() {
        console.log("Smart Protection finished...");
    .catch(function (error) {

Styling Threat Screen

Threat screen can by styled by setting custom theme for the activity and by changing icons for the image buttons on the screen.

There are two icons. Delete icon and settings icon. Delete icon serves for button requesting app uninstall (for apps that can be uninstalled). Settings icon serves for button opening app’s detail in system settings (for apps that cannot be uninstalled) where user can disable the app.

The theme for the screen should contain standard Android attributes and can contain couple of extra attributes defined by the AV SDK.

We recommend to derive the theme from AppCompat themes. The usage of ActionBar in the screen is derived from the theme. Use NoActionBar version of the theme for design without the ActionBar (contains the app name). Alternatively you can hide the ActionBar by adding

<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>

to your theme.

Following is an example of a theme using Wultra-defined attributes that you can put into your android/app/src/main/res/values/malwarelytics.xml file.

    <style name="CustomAppTheme" parent="Theme.AppCompat.NoActionBar">
        <item name="colorPrimary">#FF0000</item>
        <item name="colorPrimaryDark">#222222</item>
        <item name="colorAccent">#FF0000</item>

        <item name="titleTextColor">@android:color/black</item>

        <!-- <item name="android:windowBackground">@drawable/img_bg_app</item> -->

        <!-- <item name="android:fontFamily">@font/font_family_roboto</item>
        <item name="fontFamily">@font/font_family_roboto</item> -->

        <!-- <item name="buttonStyle">@style/CustomAppTheme.Button.Filled</item> -->
        <item name="imageButtonStyle">@style/CustomAppTheme.ImageButton.Borderless</item>

        <item name="wultraThreatTitleTextAppearance">@style/CustomAppTheme.TextAppearance.Title</item>
        <item name="wultraThreatTitleStyle">@style/CustomAppTheme.TextView.Title</item>
        <item name="wultraThreatDescriptionTextAppearance">@style/CustomAppTheme.TextAppearance.Description</item>
        <item name="wultraThreatDescriptionStyle">@style/CustomAppTheme.TextView.Description</item>
        <item name="wultraThreatProtipTextAppearance">@style/CustomAppTheme.TextAppearance.Description</item>
        <item name="wultraThreatProtipStyle">@style/CustomAppTheme.TextView.Description</item>

    <style name="CustomAppTheme.TextAppearance.Button" parent="TextAppearance.AppCompat.Button">
        <item name="android:textColor">@android:color/black</item>
        <item name="android:textSize">19.2sp</item>
        <item name="android:textStyle">bold</item>

    <style name="CustomAppTheme.Button.Filled" parent="Widget.AppCompat.Button">
        <item name="android:textAppearance">@style/CustomAppTheme.TextAppearance.Button</item>
        <item name="android:textAllCaps">false</item>
        <!-- <item name="android:background">@drawable/bg_button_filled</item> -->

    <style name="CustomAppTheme.ImageButton.Borderless" parent="Widget.AppCompat.ImageButton">
        <!-- <item name="android:background">@drawable/bg_button_borderless</item> -->

    <style name="CustomAppTheme.TextView"/>

    <style name="CustomAppTheme.TextView.Title">
        <item name="android:gravity">center</item>

    <style name="CustomAppTheme.TextAppearance.Title" parent="TextAppearance.AppCompat.Title">
        <item name="android:textColor">#FF0000</item>

    <style name="CustomAppTheme.TextView.Description">
        <item name="android:gravity">center</item>

    <style name="CustomAppTheme.TextAppearance.Description" parent="TextAppearance.AppCompat.Medium">
        <item name="android:textColor">@android:color/white</item>
        <item name="android:textSize">16.8sp</item>

Such custom theme can be set via gradle configuration of malwarelytics by

configureMalwarelytics owner, "USERNAME", "PASSWORD", ""

Support and Compatibility

React Native Library Native Library
0.11.x 0.11.x
Last updated on Jul 17, 2020 (15:22) Edit on Github Send Feedback



Malwarelytics for React Native