PrerequisitesTo use the fraud prevention Android SDK, you’ll need:
- Android 5.0 Lollipop (API level 21) or higher
- Device supporting armeabi-v7a, arm64-v8a, x86 or x86_64 ABI
Note - Size overheadThe average size overhead for each architecture is:
- X86: 1.6 MB
- X86_64: 1.6 MB
- ARMv8: 1.7 MB
- ARMv7: 1.7 MB
Setting up your Artifactory account
Once you sign the fraud prevention contract with Mangopay, your assigned solutions engineer assesses the integration of your application. If mobile integration is needed, you will be asked to provide the email addresses of your mobile developers. Once provided, JFrog accounts will be generated for your developers and they will receive an email to set up their account. In addition, a document with information about third-party dependencies is placed in your Artifactory repository with each release in a file called third-party-notices.txt.Caution - Locked accountsIn case of multiple failed login attempts, the system will temporarily suspend that user’s account for a brief period of time during which additional login attempts will be ignored. To unlock your account, contact your assigned solutions engineer.
Getting started
Installation with Gradle using the Maven Repository
- Log in to the Nethone Artifactory Repository.
- Under the Artifacts section, find the
nethonesdk-android-{your_company_name}
repository. - Note the repository link with the format
https://nethone.jfrog.io/artifactory/nethonesdk-android-{your_company_name}
- Include your repository link in your module’s build.gradle or settings.gradle file:
Groovy
Manual installation
Caution - Required manual updatesWith manual integration, the dependency management procedure will need to be performed again after each Nethone update. We recommend you install the SDK using Gradle.
- Log in to the Nethone Artifactory Repository.
- Under the Artifacts section, find the
nethonesdk-android-{your_company_name}
repository. - Download the artifact named
library-{version}.aar
. - Place the downloaded artifact in your module’s directory. The recommended path is
{your_app_module's_directory}/lib
. - Add the following to your module’s build.gradle or settings.gradle:
Groovy
Initializing the SDK
Before you can use the framework, you must set the Merchant Number and the Application Context.- Merchant Number – Identification number provided to you during the integration process needed before the profiler can execute any further actions.
- Application Context – Android interface allowing you to access application specific resources and classes.
android.os.Process.isIsolated()
method.
Kotlin
Profiler.initialize()
.
The initialize method can only be called once. Any subsequent calls will throw an exception.
Kotlin
Profiling attempt
Caution – Globally configurable Android settingsThis feature utilizes the capabilities of WebView. To be fully effective, the profiler uses a local database which is enabled with the webSettings.setDatabaseEnabled(true) call. This has a global effect and any further calls may be ignored. We recommend you to not set this setting to false in your own WebViews as it will also affect the profiler’s WebView.
attemptReference
is a unique, single-use identifier used to identify a specific profiling attempt which is generated automatically by the SDK. Your server will use this reference to enquire Nethone about the status of the attempt.
On mobile platforms, it starts with a mznx-
prefix, for example mznx-8c00d909-9f92-4b83-a5b2-7b65b07c704f
.
Starting an attempt
Note - Concurrency of profiling attemptsOnly one profiling attempt can be running at a time. You should wait for this attempt to finish before starting the next one. If another attempt is running, the method will throw an exception.
Profiler.begin(ProfilerOptions options)
method. Calling this method results in Listener.onBegin(String attemptReference)
being called.
In addition, you can add the class ProfilerOptions
allows you to customize the profiling session with the available version options differ per version.
Kotlin
Finalizing an attempt
TheProfiler.finish()
method makes sure that the necessary data has reached us and ends the attempt. Calling this method results in Listener.onSuccess(String attemptReference)
being executed.
Kotlin
Canceling an attempt
TheProfiler.cancel()
method immediately cancels the current profiling attempt. Calling this method results in Listener.onCancel()
being executed.
Note - Expired attempt referenceAfter finalizing the attempt, the latest attempt reference becomes invalid and can no longer be used to query our servers.
Kotlin
Optional features
Note - Adding featuresTo use any of the optional features available, please contact your assigned solutions engineer.
Behavioral analysis
TextView changesNote - Sensitive dataOnly behavioral data is gathered from views registered with the
RegisterMode.SENSITIVE
mode.TextView
data will be gathered during the profiling session.
To register a TextView
, you need to use the registerTextView
and add the following arguments:
textView
– the TextView’s object name.mode
type
– type of the TextView format.
Kotlin
Profiler.dispatchTouchEvent(ev)
method.
Kotlin
Logging
Caution – Disable all logging before releasePlease note that this feature needs to be disabled before releasing your application.
Profiler.setLogLevel(int level)
method. It supports the following values:
0
– Off1
– Fatal2
– Error3
– Warn4
– Info5
– Debug
Location permissions
Before enabling data location collection during profiling, the application should handle authorization from the user before profiling starts. To collect the most precise location data from the user, there are 2 needed permissions:ACCESS_COARSE_LOCATION
– Data from the most battery-efficient non-GPS provider available.ACCESS_FINE_LOCATION
– GPS data in reporting user location.
manifest
XML
requestPermissionLauncher
variable in your activity.
Kotlin
Kotlin
Read and write external storage permissions
Before enabling these permissions, the application should handle authorization from the user before profiling starts. As the SDK saves universally unique identifiers (UUIDs) values on the external storage, the permission allows the data to persist through app re-installation on APIs on and below API 28. For more information, see the Android Developers Manifest.permission article. 1. In the activity_main.xml file, add the following in yourmanifest
tag:
XML
requestPermissionLauncher
variable in your activity.
Kotlin
Kotlin
Listener
The Listener interface is a way of notifying you of different events occurring in your profiling attempt. It has four main methods:Listener.onBegin(String attemptReference)
passes the attempt reference through the listener after the profiling session is created.Listener.onSuccess(String attemptReference)
queries the server to provide results after the profiling attempt is finalized.Listener.onCancel()
aborts the listener of the current profiling attempt.Listener.onError(String attemptReference, String message)
is executed after an error occurs in the profiling attempt. Themessage
argument contains information about the error.
Kotlin
Kotlin
Kotlin
Kotlin