Integrating the PolyNet™ SDK

This document is for PolyNetSDK version 3 for Android.

Requirements

The SDK supports devices with these minimum requirements:

Supported CPU architectures:

Known limitations

Emulation support

Android Studio default emulators may not work properly with PolyNet. We recommend trying other emulators or simply testing with mobile devices.

CPU architectures

PolyNet SDK depends on third party native code libraries. If you use additional native code libraries in your app, please take the following into account:

Android's way of managing multiple native code libraries bundled within the same app is as follows:

  1. When you launch an app in a phone / device, Android searches all of the bundled libraries for the closest CPU architecture to the device's actual CPU.
  2. Any library that doesn't specifically support that CPU architecture may not load, even if it supports a backward compatible CPU.

For example: An app uses two libraries, supporting the following architectures:

If you try the app in a phone with an armeabi-v7a CPU, it may run fine. But, the very same app in a phone with an arm64-v8a CPU may fail to load library #2.

You should make sure that all libraries that you include in your project, or get included as dependencies, support at least the CPUs listed at Requirements.

TLS support on Android 4

PolyNet uses up-to-date TLS versions. Android 4.x devices ship with TLS v1.2, but it is disabled by default. To enable it, you have to patch the device's security provider. You can follow the recommended practice here: Updating Your Security Provider to Protect Against SSL Exploits.

In short:

Just call ProviderInstaller.installIfNeeded() or ProviderInstaller.installIfNeededAsync() once, during your app's initialisation process.

The device must have Google Play Services and Google Play for this to work. If they are not installed, ProviderInstaller will fail with an exception. You can catch it and prompt the user to install or update Google Play Services.

Installing or updating Google Play Services depends on the country and device brand. If the device comes with Google Play app, the user can install Google Play Services from it. If not, the user has to manually find and install two APK files (Google Play and Google Play Services). Also, Google Play Services may have been banned in some countries.

You can detect the affected Android versions like this:

if (Build.VERSION.SDK_INT >= 15 && Build.VERSION.SDK_INT <= 20) {

    // ... you are running inside Android 4

}

Integration sample

A reference integration sample application can be obtained from here. Once you download the repository, import it in Android Studio using the Import project... option from the menu. Build and run the application when you are ready. The required parameters and order of operations are described in detail below.

Downloads

The Android SDK is automatically downloaded when adding the corresponding dependency in the build.gradle file, as explained in the following section. Please contact System73 Support for Android SDK download information.

Adding the PolyNet SDK to your project

Permissions

Add the following permissions in your project's AndroidManifest.xml file:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Gradle setup

To integrate the SDK, first set up the System73 Maven repository in the project's build.gradle file:

allprojects {
   repositories {
       // ... other repositories
       maven {
           url "https://<SYSTEM73_MAVEN_HOST>/repository/maven-s73-releases"
       }
   }
}

Then add the following sentence inside the dependencies section of the module's build.gradle file:

implementation 'com.system73.polynet:polynet-android-sdk:3.2.0-xxx'

This will automatically download and import the SDK and all its required dependencies in your Android project.