mFilterIt React-Native Integration

This guide details the steps to integrate the MFilterIt SDK into a react-native Android App

Getting Started

Integrating the mFilterIt Solution into an app includes Developer Registration and SDK integration.

Developer Registration

Developers wishing to use mFilterIt should first register themselves. Upon registration, a unique vendor ID will be allocated.

Please contact us to initiate the registration, at contact@mfilterit.com

SDK Integration

The SDK integration can be done by adding the SDK jar to the project.

Step 1 : The SDK is made available as a jar archive . This archive needs to be included into App project.

Step 2 : Provide permissions to the SDK The mFilterIt SDK requires the following permissions to be granted in the Android manifest file

Permission

Level

Description

ACCESS_NETWORK_STATE

Mandatory

Allows applications to access information about networks

READ_PHONE_STATE

Mandatory

Allows read only access to phone state.

INTERNET

Mandatory

Allows access to the internet

WRITE_EXTERNAL_STORAGE

Optional

Allows write into external storage area

ACCESS_WIFI_STATE

Optional

Allows application to query Wifi state

GET_ACCOUNTS

Optional

Allows application to access Google accounts data

READ_CALL_LOG

Optional

Allows an application to read the user's call log

READ_SMS

Optional

Allows an application to read SMS messages.

READ_CONTACTS

Optional

Allows an application to read the user's contacts data.

The mFilterIt algorithm works most efficiently when all permissions are allowed. However, the SDK is able detect some fraudulent activity with the mandatory permissions itself.

Step 3 : Insert the following lines inside the dependencies block in android/app/build.gradle :

compile files('$PATH$/Mfilterit_SDK_latest_p.jar')

Here $PATH$ is the file path of jar file relative to root path.

Step 4 : Open up android/app/src/main/java/[...]/MainApplication.java and add the following line to imports (at the top of the file):

import com.mfilterit.MFilterIt;

Step 5 : Initialize the SDK, The SDK is initialized by invoking the sdkInit API. This should be done in the OnCreate routine of the MainApplication.java. sdkInit is invoked as shown below The below is a description of the parameters taken by the sdkInit Routine.

MFilterIt.sdkInit(Context context, String vendorId, int extDataPoints);

Parameter

Description

context

Context object returned by getApplicationContext

vendorId

This is a unique Vendor ID string allocated to the app developer. The Vendor ID is provided to you at registration, and is critical to identify the server side endpoint. Please contact us for the Vendor ID, at contact@mfilterit.com

extDataPoints

Set to "MfilterIt.DATAPOINTS_LEVEL_1"

A code snippet of a sample OnCreate is captured below

@Override
  public void onCreate() {
    super.onCreate();
    MFilterIt.sdkInit(getApplicationContext(), "vendorId", MFilterIt.DATAPOINTS_LEVEL_1 );
  }

Points to remember : 1. For Android 6.0+ devices, please take the mandatory permissions from the user before the SDK is triggered. The SDK does not take any permissions on its own, and depends on the app to take the needed permissions before hand.

2. Please update the following in proguard rules file ( in case of encrypted jar uses):

-keep public class com.mfilterit.{ ; } 
-keep public class com.a.e.{ ; }

Last updated