Skip to main content

Get Started

Android#

Guardian SDK for Android(hereafter 'Android SDK') provides the development kit to implement Guardian-CCS authentication in the Android app.
This document will describe how to make best use of the Android SDK.


App Registration#

In order to use the Android SDK, the app must be registered beforehand.We recommend you to check the app registration page in the next chapter for more details.

Installation#

Set Gradle#

Declare the Android SDK repository in the build.gradle(Project) to implement the Android SDK.

maven {     url "https://nexus.fnsvalue.co.kr/repository/maven-releases/"}

Add Modules#

Add necessary modules in the build.gradle(Module).

dependencies {    implementation 'com.fnsvalue:GuardianLibrary:1.0.2@aar'}

External library dependency#

It needs to be manually installed in an external library required for Guardian SDK

dependencies {    implementation 'com.squareup.okhttp3:logging-interceptor:3.14.9'    implementation 'com.squareup.retrofit2:retrofit:2.9.0'    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'    implementation 'com.google.code.gson:gson:2.8.6'    implementation 'com.github.NaikSoftware:StompProtocolAndroid:1.6.4'    implementation "androidx.biometric:biometric:1.0.1"
    implementation group: 'io.reactivex.rxjava2', name: 'rxjava', version: '2.2.5'}

Internet Permission#

Internet permissions must be set on the app for API and communication through our Android SDK.
To communicate with the API through Android SDK, the app must have access to the internet.
It can be setup at the AndroidManifest.xml as follows.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"    package="com.example.sample">
    <!-- Internet Usage Permission Setting-->    <uses-permission android:name="android.permission.INTERNET" />        ....    </manifest>

JAVA 8 Configuration#

Specify the Java version in the build.gradle(Module) file to use the Java 8 features.
Refer to the following example:

android {    compileOptions {        sourceCompatibility JavaVersion.VERSION_1_8        targetCompatibility JavaVersion.VERSION_1_8    }    ....}

Runtime Permission#

Android 6.0 Marshmallow (API 23), or higher version requires the runtime permission to use the resources of device.
The following are required permissions of the Android SDK to be declared.



if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {    if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED ||        ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {    }}

Each of the permissions will be used for the following purposes.

  • ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION for sign in/re-registration by using location information.

Initialization#

For initial setup, the Android SDK must be initialized after the installation.
It can be initialized as follows:

public class GlobalApplication extends Application {    @Override    public void onCreate() {        super.onCreate();
        GuardianSdk.getInstance().init(this, "{Client Key}", "{API SERVER URL}");            }}