Skip to content

Commit c29b482

Browse files
authored
Merge pull request #3 from socure-inc/2420-v2-v3
sample app - v2
2 parents 1cd2ffc + ef83e1c commit c29b482

File tree

78 files changed

+1541
-727
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1541
-727
lines changed

README.md

Lines changed: 51 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,82 @@
1-
# Document Verification Android SDK
1+
# Predictive DocV Android SDK v3
22

3-
The Document Verification Android SDK provides a framework to add image capture and upload services to your native Android applications. The SDK supports image capture for both Android and iOS. This guide covers only Android.
3+
The Predictive Document Verification (Predictive DocV) Android SDK v3 provides a framework to add image capture and upload services to your mobile application.
44

55
## Minimum Requirements
66

7-
| Feature | Minimum Requirements |
8-
|----------------------------------|----------------------|
9-
| Android SDK | `minSdkVersion 22` |
10-
| Document and Selfie Auto Capture | Android 8 and above |
7+
- Android SDK Version 22 (OS Version 5.1) and later
8+
- Android SDK is compiled with `compileSdkVersion 32` and Java 11
119

12-
### OkHttp3 and Retrofit dependencies
13-
14-
| Feature | Version |
15-
|----------|---------|
16-
| okHttp | 4.9.3 |
17-
| retrofit | 2.9.0 |
10+
## Configuration and integration
1811

12+
The Predictive DocV Android SDK v3 allows integration as simple as writing a single line of code:
1913
```
20-
def retrofitVersion = '2.9.0'
21-
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
22-
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
23-
24-
def okHttpVersion = '4.9.3'
25-
implementation "com.squareup.okhttp3:okhttp:$okHttpVersion"
26-
implementation "com.squareup.okhttp3:logging-interceptor:$okHttpVersion"
14+
SocureDocVHelper.getIntent(context, socure-api-key, config)
2715
```
2816

29-
## Installation
17+
| Argument | Description |
18+
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
19+
| `SocureDocVHelper` | A framework helper class. |
20+
| `socure-api-key` | The unique SDK key obtained from Admin Dashboard. For more information on SDK keys, see the Admin Dashboard User Guide. |
21+
| `context` | Activity context |
22+
| `config` | An optional JSON string or null value that specifies a custom flow. The `flow_1` value specifies the name of the flow (created in Admin Dashboard) that the Predictive DocV SDK should use. <br /> <br />`{"flow": {"name": "flow_1"}}` <br /> <br />If the value is `null`, the Predictive DocV SDK will fetch Socure's default flow. |
3023

31-
To install the DocV Android SDK, you must perform the following steps:
32-
- [Add Socure to the build.gradle](#add-socure-to-the-buildgradle)
33-
- [Update permissions](#update-permissions)
34-
- [Add API keys](#add-api-keys)
24+
Before you can use the Predictive DocV Android SDK v3, you must perform the following steps:
3525

36-
### Add Socure to the build.gradle
26+
- [Add SDK dependencies](#add-sdk-dependencies)
27+
- [Camera permissions](#camera-permissions)
28+
- [Launch Socure DocV SDK](#launch-socure-docv-sdk)
3729

38-
You must add the following to your `build.gradle`:
30+
### Add SDK dependencies
3931

40-
- Add the maven URL in the root/project level `build.gradle`:
32+
In your root `build.gradle` file, at the end of the `allprojects` > `repositories` section, add the Socure DocV SDK Maven repository.
4133

34+
```kotlin {4}
35+
allprojects {
36+
repositories {
37+
...
38+
maven { url 'https://jitpack.io' }
39+
}
40+
}
4241
```
43-
(NOT IN THE `buildscript` code block above. allprojects is a sibling to build script)
4442

43+
In your module level `build.gradle` file, add the following Socure DocV SDK dependency:
4544

46-
allprojects {
47-
repositories {
48-
.......
49-
50-
maven {
51-
url "https://jitpack.io"
52-
}
53-
}
54-
}
55-
```
45+
```kotlin {2}
46+
dependencies {
47+
implementation 'com.github.socure-inc:socure-docv:x.y.z'
48+
}
49+
```
5650

57-
- Add the following to the `build.gradle` of the module/library that uses the framework:
51+
### Camera permissions
5852

59-
```
60-
dependencies {
61-
implementation 'com.github.socure-inc:android-sdk:2.0.13'
62-
}
63-
```
53+
The Predictive DocV Android SDK requires camera permission to capture identity documents. Upon the first invocation of the SDK, your app will request camera permission from the user.
6454

65-
### Update permissions
55+
**Note**: We recommend you check for camera permissions before calling the Socure DocV SDK’s launch API.
6656

67-
Make the following permission updates for Android in the Android.manifest:
57+
#### Required permissions
58+
59+
Ensure that your app manifest has been set up properly to request the following required permissions:
6860

6961
```
70-
<uses-permission android:name="android.permission.CAMERA"></uses-permission>
71-
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
72-
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
73-
<uses-feature android:name="android.hardware.camera.autofocus" />
74-
<uses-feature android:name="android.hardware.camera.flash" android:required="false" />
7562
<uses-feature android:name="android.hardware.camera" />
76-
<uses-permission android:name="android.permission.VIBRATE" />
77-
```
7863
79-
### Add API keys
64+
<!-- Declare permissions -->
65+
<uses-permission android:name="android.permission.CAMERA" />
66+
<uses-permission android:name="android.permission.INTERNET" />
67+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
68+
69+
```
8070

81-
Use the Admin Dashboard to find the Socure public key.
71+
### Launch Socure DocV SDK
8272

83-
- Add the key to your application:
73+
To launch the Socure DocV SDK, call the launch function using `ActivityResultLauncher`.
8474

8575
```
86-
<string name="socurePublicKey" translatable="false">YOUR_KEY_HERE</string>
87-
```
88-
- Add the API key to `string.xml` as a resource.
76+
val startForResult: ActivityResultLauncher<Intent> = registerForActivityResult(...)
77+
...
78+
startForResult.launch(SocureDocVHelper.getIntent(context, socure-api-key, config))
8979
90-
### Configuration and usage
80+
```
9181

92-
For instructions on how to configure the SDK, see the [Android SDK documentation](https://developer.socure.com/docs/sdks/docv/android-sdk).
82+
Once the Socure DocV SDK is successfully launched, you will be able to set up a listener for Callback Events and customize the most aspect of the interface. For more information, see the [Android SDK documentation](https://developer.socure.com/docs/sdks/docv/android-sdk/android-sdk-v3/) on DevHub.
File renamed without changes.

sample-app/.gitignore

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1-
keystore/
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties
16+
.idea

sample-app/app/.gitignore

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1 @@
1-
/build
2-
build/
3-
.gradle/
4-
.idea/
5-
.DS_Store
6-
7-
# Built application files
8-
*.apk
9-
*.ap_
10-
*.aab
11-
12-
# Files for the ART/Dalvik VM
13-
*.dex
14-
15-
# Java class files
16-
*.class
17-
18-
19-
bin/
20-
gen/
21-
out/
22-
23-
local.properties
24-
25-
proguard/
26-
27-
*.log
28-
.navigation/
29-
30-
captures/
31-
32-
.externalNativeBuild
33-
34-
output.json
1+
/build

sample-app/app/build.gradle

Lines changed: 23 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,47 @@
1-
apply plugin: 'com.android.application'
2-
apply plugin: 'kotlin-android'
3-
apply plugin: 'kotlin-android-extensions'
4-
apply plugin: 'kotlin-kapt'
1+
plugins {
2+
id 'com.android.application'
3+
id 'org.jetbrains.kotlin.android'
4+
}
55

66
android {
7-
useLibrary 'org.apache.http.legacy'
8-
compileSdkVersion 32
7+
compileSdk 32
98

109
defaultConfig {
11-
applicationId "com.socure.demo.demosk"
12-
minSdkVersion 22
13-
targetSdkVersion 32
14-
versionCode 2014
15-
versionName "2.0.14"
16-
}
17-
18-
def localProperties = new Properties()
19-
localProperties.load(new FileInputStream(rootProject.file("local.properties")))
10+
applicationId "com.socure.docv.sdk.sample"
11+
minSdk 22
12+
targetSdk 32
13+
versionCode 1
14+
versionName "1.0"
2015

21-
signingConfigs {
22-
release {
23-
storeFile file(localProperties['keystore.release.filepath'])
24-
storePassword localProperties['keystore.release.password']
25-
keyAlias localProperties['key.release.alias']
26-
keyPassword localProperties['key.release.password']
27-
}
16+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2817
}
2918

3019
buildTypes {
31-
debug {
32-
debuggable true
33-
}
34-
3520
release {
36-
debuggable false
37-
minifyEnabled true
21+
minifyEnabled false
3822
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
39-
signingConfig signingConfigs.release
4023
}
4124
}
42-
4325
compileOptions {
4426
sourceCompatibility JavaVersion.VERSION_11
4527
targetCompatibility JavaVersion.VERSION_11
4628
}
47-
4829
kotlinOptions {
49-
jvmTarget = JavaVersion.VERSION_11
50-
}
51-
52-
viewBinding {
53-
enabled = true
54-
}
55-
56-
applicationVariants.all { variant ->
57-
variant.outputs.all {
58-
outputFileName = "${variant.name}-${variant.versionName}.apk"
59-
}
60-
}
61-
}
62-
63-
allprojects {
64-
repositories {
65-
maven { url 'https://jitpack.io'}
30+
jvmTarget = '1.8'
6631
}
6732
}
6833

6934
dependencies {
70-
implementation 'androidx.core:core-ktx:1.7.0'
71-
implementation 'androidx.appcompat:appcompat:1.4.1'
72-
implementation 'com.google.android.material:material:1.5.0'
73-
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
74-
implementation 'com.karumi:dexter:6.2.1'
75-
implementation 'com.google.code.gson:gson:2.9.0'
7635

77-
// socure document verification sdk dependency
78-
implementation 'com.github.socure-inc:android-sdk:2.0.14'
79-
}
36+
implementation 'androidx.core:core-ktx:1.8.0'
37+
implementation 'androidx.appcompat:appcompat:1.4.2'
38+
implementation 'com.google.android.material:material:1.6.1'
39+
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
8040

41+
def docV_version = "3.0.0"
42+
implementation "com.github.socure-inc:socure-docv:$docV_version"
8143

44+
testImplementation 'junit:junit:4.13.2'
45+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
46+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
47+
}

sample-app/app/proguard-rules.pro

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
1-
-keepnames class com.socure.idplus.*
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
27

3-
-assumenosideeffects class android.util.Log {
4-
public static boolean isLoggable(java.lang.String, int);
5-
public static int v(...);
6-
public static int i(...);
7-
public static int w(...);
8-
public static int d(...);
9-
public static int e(...);
10-
}
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
1114

12-
-keepnames class * implements java.io.Serializable
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
1318

14-
-keepclassmembers class * implements java.io.Serializable {
15-
static final long serialVersionUID;
16-
static final java.io.ObjectStreamField[] serialPersistentFields;
17-
!static !transient <fields>;
18-
private void writeObject(java.io.ObjectOutputStream);
19-
private void readObject(java.io.ObjectInputStream);
20-
java.lang.Object writeReplace();
21-
java.lang.Object readResolve();
22-
}
23-
24-
-dontwarn okhttp3.**
25-
-dontwarn retrofit2.**
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.socure.docv.sdk.sample
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("com.socure.docv.sdk.sample", appContext.packageName)
23+
}
24+
}

0 commit comments

Comments
 (0)