Giter Club home page Giter Club logo

de.idnow.android's Introduction

Table of Contents

Overview

This SDK supports AndroidStudio.

Examples

Please see https://github.com/idnow/de.idnow.android-sample for a sample applications

Requirements

  • minSdkVersion: 21 (Android 5.0)
  • targetSdkVersion: 31 (Android 12.0 Snow Cone)
  • Internet connection, communication via standard SSL port 443

Supported versions

  • Your current SDK will stop receiving further support by May 21 2020 (VideoIdent SDKs of version 4.2.0 and lower; 4.2.1 and higher continue to be supported)
  • After this time, the old SDK will continue to be operational, but we won’t provide any more updates and maintenance only with additional reimbursement

AndroidManifest

The following permissions are required:

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

If Video-Ident will be used, the following permissions are required as well:

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

If EID will be used, the following permission is required as well:

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

Additional permissions for certain audio devices:

<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

Moreover, when using an Android LibraryProject, all the Activities, Services and from the LibraryProject (SDK) have to be mentioned in your Apps AndroidManifest. The simplest way is just to copy the corresponding part of the IDnowSDK AndroidManifest.

Android Studio

How to import the SDK

Watch the video

In your top-level build.gradle project file add the following url under repositories block:

allprojects {
repositories {
..
maven {
url "https://raw.githubusercontent.com/idnow/de.idnow.android/master"
}
..
}
}

and in the dependencies part of your app.gradle add:

dependencies {
..
implementation 'de.idnow.sdk:idnow-android-sdk:5.x.x'
..
}

How to use the .aar file:

Watch the video

Copy the idnow-android-.aar into the apps libs folder.

In your app.gradle add:

repositories {
	
maven {
  url "https://raw.githubusercontent.com/idnow/de.idnow.android/master"
       }
	
flatDir {
dirs 'libs' //this way we can find the .aar file in libs folder
}
}

Additional dependencies to add in your app.gradle:

dependencies {
    implementation 'de.idnow.sdk:idnow-android-x.x.x@aar'
    implementation 'com.squareup.retrofit:retrofit:1.9.0'
    implementation 'com.squareup.okhttp3:okhttp:4.9.1'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.annotation:annotation:1.3.0'
    implementation "androidx.constraintlayout:constraintlayout:2.1.3"
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'androidx.recyclerview:recyclerview:1.2.1'
    implementation 'com.googlecode.libphonenumber:libphonenumber:8.10.9'
    implementation 'me.relex:circleindicator:1.3.2'
    implementation 'de.idnow.insights:idnow-android-insights-sdk:1.0.0'
    compileOnly 'de.idnow.android.eid:idnow-android-eid-sdk:2.4.0'
    implementation 'com.airbnb.android:lottie:5.1.1'
    implementation 'androidx.preference:preference:1.2.0'
    implementation "androidx.percentlayout:percentlayout:1.0.0"
    implementation  'com.google.code.gson:gson:2.8.6'
    implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
    implementation 'com.google.android.material:material:1.5.0'
    }

App Bar

During the use of the SDK the app is NOT showing an App Bar since the ident follows exact predefined steps the user can't influence and because there is nothing to search for.

SDK size

By default the SDK has a size of roughly 15 mb.

Multidex support

Your project might require the usage of multidex if it comes over 65k methods. Please see http://developer.android.com/tools/building/multidex.html for details

Proguard support

A proguard file is supplied in this project as well.

Usage

The ONLY class in the SDK designated for user access is the IDnowSDK class.

To create an instance of the IDnow SDK, perform the following call and provide the companyid, which was provided to you during setup as well as an activity that receives callbacks. IDnowSDK is a singleton class, so whenever you need to call it just do so with IDnowSDK.getInstance().

IDnowSDK.getInstance().initialize(<Activity>, "<companyid>");

Set the static parameters for the SDK usage. Context has to be passed, as parameters are persisted in Preferences. You can decide whether to let the user confirm legal agreements (setShowVideoOverviewCheck). You also can decide if after the identification the IDnow Error/SuccessScreen is shown, or if the callback to your app is triggered right after identification is finished.

IDnowSDK.setShowVideoOverviewCheck(<true/false>, <Context>);
IDnowSDK.setShowErrorSuccessScreen(<true/false>, <Context>);

To actually start the identification pass your transaction token.

IDnowSDK.getInstance().start(<Your transaction token>);

Here is the full example:

try {
	// Initialize with your activity which will handle the SDK callback and pass the id of your company.
	//	IDnowSDK is a singleton class, so just call it with IDnowSDK.getInstance()
	IDnowSDK.getInstance().initialize(StartActivity.this, "ihreBank");

	// Set the transactionToken, for example from a TextField
	IDnowSDK.setTransactionToken(editTextToken.getText().toString(), context);

	// You can decide whether to let the user confirm the legal points.
	IDnowSDK.setShowVideoOverviewCheck(true, context);

	// Same goes to the success screen. If none is shown, the app sends the results right back.
	// The defaults for the both parameters are "true";
	IDnowSDK.setShowErrorSuccessScreen(true, context);

	// Optionally set against which environment the app has to test. Possibilities are DEV, TEST, LIVE, with LIVE being the default.
	IDnowSDK.setEnvironment( Server.TEST );
	
	
	// Set the custom certificate provider
	IDnowSDK.setCertificateProvider(new CustomerCertificateProvider(this.context))

	// To actually start the identification process, pass the transactionToken.
	IDnowSDK.getInstance().start(IDnowSDK.getTransactionToken(context));
} catch (Exception e) {
	// The SDK checks the input parameters and throws an exception if they don't seem right.
	e.printStackTrace();
}

The SDK checks the input parameters and throws an Exception if something is deemed not right, to provide you with quick feedback. Handle it as desired.

To handle the results of the identification, implement the standard onActivityResult function in your activity.:

	@Override
	protected void onActivityResult( int requestCode, int resultCode, Intent data )
	{
		if ( requestCode == IDnowSDK.REQUEST_ID_NOW_SDK )
		{
			if ( resultCode == IDnowSDK.RESULT_CODE_SUCCESS )
			{
                If ( data != null )
                {
                    String transactionToken = data.getStringExtra(IDnowSDK.RESULT_DATA_TRANSACTION_TOKEN);
                    Log.v(TAG, "success, transaction token: " + transactionToken);
                }
			}
			else if ( resultCode == IDnowSDK.RESULT_CODE_CANCEL )
			{
                if ( data != null )
                {
                    String transactionToken = data.getStringExtra(IDnowSDK.RESULT_DATA_TRANSACTION_TOKEN);
                    String errorMessage = data.getStringExtra(IDnowSDK.RESULT_DATA_ERROR);
                    Log.v(TAG, "canceled, transaction token: " + transactionToken + “, error: “ + errorMessage);
                }
			}
			else if ( resultCode == IDnowSDK.RESULT_CODE_FAILED )
			{
                if ( data != null )
                {
                    String transactionToken = data.getStringExtra(IDnowSDK.RESULT_DATA_TRANSACTION_TOKEN);
                    String errorMessage = data.getStringExtra(IDnowSDK.RESULT_DATA_ERROR);
                    Log.v(TAG, "failed, transaction token: " + transactionToken + “, error: “ + errorMessage);
                }
			}
			else
			{
				Log.v(TAG, "Result Code: " + resultCode);
			}
		}
	}

Additional settings

You can set the connection type to use: websockets.

IDnowSDK.setConnectionType(IDnowSDK.ConnectionType.WEBSOCKET, context);

You can force one of the environments to use. Default is to determine this by the token used.

IDnowSDK.setEnvironment(IDnowSDK.Server.TEST);

You can disable logging of the SDK by using

IDnowSDK.disableLogging();

You can set to use your own servers. When this setting is enabled, apiHost, webHost and websocketHost must also be set.

IDnowSDK.setEnvironment(IDnowSDK.Server.CUSTOM);
IDnowSDK.setApiHost("https://api.yourserver.com", context);
IDnowSDK.setWebHost("https://www.yourserver.com", context);
IDnowSDK.setWebsocketHost("https://websocket.yourserver.com", context);
IDnowSDK.setVideoHost("https://video.yourserver.com", context);
IDnowSDK.setStunHost("video.yourserver.com", context);
IDnowSDK.setStunPort(3478, context);

You can set the new branding (Circular background for the buttons)

IDnowSDK.setNewBrand(TRUE);
	

You can set a certificateProvider

	
IDnowSDK.setCertificateProvider(customerCertificateProvider)
	

Supported by the SDK version 3.22.1 or before

It is used to provide custom DTLS certificates used by the WebRTC connection.

  • The certificate provider can be used to provide a custom DTLS certificate and configure which features the underlying WebRTC conference uses
    • featureCertificate = true
    • featureFingerPrint = true
    • featureServerCert = true

Using IDnow with other native libraries (UnsatisfiedLinkError)

For Videostreaming the Idnow SDK uses IceLink which come with native libs.

If your app uses other 3rd party libs that come with their own native libs, it's possible that you get an UnsatisfiedLinkError.

This means that the native lib folders shipped by your 3rd party lib don't match the native lib folders shipped by the Idnow SDK. Currently the Idnow SDK comes with the following folders: armeabi, armeabi-v7a, arm64-v8a. If your 3rd party lib only supports some of the architectures but not others (e.g. armeabi, x86 but not armeabi-v7a), you have to exclude the other folders of the Idnow SDK in your build.gradle (in this example: armeabi-v7a) with the following command:

android {
//...
packagingOptions {
exclude "lib/armeabi-v7a/"
//...
}

If it's the other way round (your 3rd party lib ships more than armeabi, armeabi-v7a, arm64-v8a and x86, you have to exclude these folders, so the remaining folders match the Idnow SDK folders.

For further reading: http://developer.android.com/ndk/guides/abis.html

Design configuration

Languages

In case you would like to change the language used by the IDnow SDK at runtime you can do the following in the host App during the initialization:

IDnowSDK.getInstance().initialize( StartActivity.this, "", language);

Language values are: en (English), de (German), fr (French), es (Spanish), it (Italian), pt (Portuguese), et (Estonian), hr (Croatian), hu (Hungarian), ka (Georgian), ko(Korean), lt(Lithuanian), lv (Latvian), nl (Dutch), pl (Polish), ru (Russian), zh (Chinese), uk (Ukrainian)

App icon and logo

A single icon is used as the app launcher icon and logo. You can overwrite it, if you provide assets, named "ic_launcher.png", in the following sizes in the drawable folders:

  • mdpi: 48px * 48px
  • hdpi: 72px * 72px
  • xhdpi: 96px * 96px
  • xxhdpi: 144px * 144px
  • xxxhdpi: 192px * 192px

You must not declare it again in your app manifest.

Colors

The IDnow SDK is designed with colors following the IDnow corporate design. You can use the SDK without making any adaptions to the colors at all. If, however you want the SDK screens to appear in different colors.

Our SDK supports Light Mode as well as the Dark Mode version. Currently, if dark mode is enabled on the user's mobile device, the SDK will automatically appear in Dark Mode.

you can make the following adaptions for Light Mode and Dark Mode:

primaryColor

Used as default color of the App and the component such as the buttons

primaryVariantColor

Used as a deactivated color for the buttons, it should use same value as primaryColor with a transparent code.

primarytextColor

Used as a text color for the whole App

bgPrimaryColor

Used as background color for the screens.

bgSecondaryColor

Used as background color for the text fields

basicInputField

Used as text color for the text fields

We offer as well a customisation for specific screens only for VI (VI+ disabled) such as Overview Check Screen, Call Quality Screen and Success&Error Screen, the color keys for each screen could be provided seperately on demand.

App theme

This is themes.xml of the SDK:

<resources>

    <!-- IdnowSdkTheme is used when no other theme is applied. You are free to adapt the SDK theme in the App or use your own theme.

    <style name="IdnowSdkTheme" parent="IdnowSdkThemeWithoutBackround">
        <item name="android:background">@color/bgPrimaryColor</item>
        <item name ="android:colorBackground">@color/bgPrimaryColor</item>
    </style>
    
        <style name="IdnowSdkThemeWithoutBackround"
        parent="Theme.AppCompat.DayNight">
        <item name="android:textColor">@color/primarytextColor</item>
        <item name="android:editTextStyle">@style/IdnowSdkTheme.EditText</item>
    </style>

        <style name="IdnowSdkTheme.EditText" parent="android:Widget.EditText">
        <item name="android:textColor">@color/primarytextColor</item>
        <item name="android:colorBackground">@color/bgSecondaryColor</item>
    </style>

</resources>
  • By not specifying a theme at all, the SDK's theme is used for the whole app.
  • Inheriting from the SDK's theme. Here is a usage example (themes.xml):
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <style name="MyAppTheme"
           parent="@style/IdnowSdkTheme">
    <!-- Your definitions here -->
    </style>

</resources>

Fonts

   setDefaultFont(Context context, String staticTypefaceFieldName, String fontAssetName)

Here an example on how to set custom font

  FontsOverride.setDefaultFont(this, "SERIF", "roboto_thin_italic.ttf");
	

Texts

The SDK provides English, German, French, Spanish, Italian, Hungarian, Georgian, Korean, Dutch, Polish, Portuguese, Russian and Chinese texts.

IDnow eID SDK

IDnow eID feature is a seperate module in Video ident Product.

eID Requirements

  • public.electronicID set to true in customer config
  • Device supporting NFC feature

eID Installation

Host App settings

How to import eID SDK

in build.gradle file add the following instructions:

android {
defaultConfig {
….
multiDexEnabled true
…
}
compileOptions {
    sourceCompatibility 1.8
    targetCompatibility 1.8
}
packagingOptions {
    exclude 'META-INF/*.kotlin_module'
}
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url = uri("https://repo.authada.de/public/")
            authentication {
                basic(BasicAuthentication)
            }
            credentials {
                username "*********"
                password "*********"
            }
        }
        maven {
            url "https://raw.githubusercontent.com/idnow/de.idnow.android/master"
        }
    }
} 

Dependencies {
compile 'de.idnow.sdk:idnow-android:x.x.x'
compile 'de.idnow.android.eid:idnow-android-eid-sdk:x.x.x'
}

Import the SDK as .aar file

We offer the possibility to import the SDK as an .aar file instead.

Copy the idnow-android-x.x.x.aar and idnow-android-eid-sdk-x.x.x.aar files into the apps libs folder.

android {
defaultConfig {
….
multiDexEnabled true
…
}
compileOptions {
    sourceCompatibility 1.8
    targetCompatibility 1.8
}
packagingOptions {
    exclude 'META-INF/*.kotlin_module'
}
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url = uri("https://repo.authada.de/public/")
            authentication {
                basic(BasicAuthentication)
            }
            credentials {
                username "*********"
                password "*********"
            }
        }
        flatDir {
        dirs 'libs' //this way we can find the .aar file in libs folder
        }
    }
}

Dependencies {
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.annotation:annotation:1.3.0'
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'com.squareup.retrofit:retrofit:1.9.0'
    implementation 'com.squareup.okhttp3:okhttp:3.12.1'
    implementation  'com.google.code.gson:gson:2.8.6'
    implementation 'de.idnow.insights:idnow-android-insights-sdk:1.0.0'
    implementation 'com.airbnb.android:lottie:5.1.1'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'com.googlecode.libphonenumber:libphonenumber:8.10.9'
    implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
    implementation group: 'de.authada.library', name: 'aal', version: '4.15.2'
    testImplementation 'junit:junit:4.12'
	
	
} 

eID Colors

colors are customisable by overriding the values of a specific key

primaryColor

Used as default color of the App and the component such as the buttons

primaryVariantColor

Used as a deactivated color for the buttons, it should use same value as primaryColor with a transparent code.

primarytextColor

Used as a text color for the whole App

bgPrimaryColor

Used as background color for the screens.

bgSecondaryColor

Used as background color for the text fields

basicInputField

Used as text color for the text fields

<!-- Primary color is used for the brand color -->
<color name="primaryColor">#DE6240</color>
 <!-- PrimaryVariant color is used for the transparent brand color  -->
<color name="primaryVariantColor">#80DE6240</color>
<!-- background primary color is used for the background color -->
<color name="bgPrimaryColor">#32343F</color>
<!-- background secondary color is used for the text field background -->
<color name="bgSecondaryColor">#39414A</color>
<!-- background primarytext color is used for the main text color -->
<color name="primarytextColor">#FFFFFF</color>
<!-- basic inputfield color is used for the textfield text color -->
<color name="basicInputField">#AAA7A8</color>

de.idnow.android's People

Contributors

souheib93 avatar arminbauer avatar kbarzen-idn avatar hkretzschmar avatar reichhartd avatar monisnap-julien avatar sonicdoe avatar mathiasgrasy avatar p-fischer avatar vmalinskyi avatar aare-undo-idnow avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.