Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MYID Public Code
MyID Sample Android
Commits
881c66f7
Commit
881c66f7
authored
Nov 15, 2022
by
Javokhir
Browse files
Added possibility of using sdk_hash and updated CameraX version
parent
54c85959
Changes
9
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
881c66f7
...
...
@@ -73,7 +73,7 @@ dependencies {
implementation
(
"androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
)
implementation
(
"androidx.lifecycle:lifecycle-runtime-ktx:2.5.1"
)
def
cameraVersion
=
"1.
2
.0-
rc
01"
def
cameraVersion
=
"1.
3
.0-
alpha
01"
implementation
(
"androidx.camera:camera-camera2:$cameraVersion"
)
implementation
(
"androidx.camera:camera-lifecycle:$cameraVersion"
)
implementation
(
"androidx.camera:camera-view:$cameraVersion"
)
...
...
@@ -117,6 +117,7 @@ class YourActivity : AppCompatActivity(), MyIdResultListener {
val
myIdConfig
=
MyIdConfig
.
builder
(
clientId
=
/* Your client id */
)
.
withPassportData
(
passportData
)
.
withBirthDate
(
dateOfBirth
)
.
withSdkHash
(
sdkHash
)
.
withExternalId
(
externalId
)
.
withThreshold
(
threshold
)
.
withBuildMode
(
MyIdBuildMode
.
PRODUCTION
)
...
...
@@ -141,6 +142,7 @@ Method | Notes | Default
--- | --- | ---
`withPassportData(value: String)`
| Passport serial number or PINFL data | Optional
`withBirthDate(value: String)`
| Date of birth in. Format:
`dd.MM.yyyy`
| Optional
`withSdkHash(value: String)`
| 32 characters long string | Optional
`withExternalId(value: String)`
| 36 characters long. Should match with UUID4 regex | Optional
`withThreshold(value: Float)`
| The value can be in the range of
`0.50`
-
`0.99`
| 0.50
`withBuildMode(value: MyIdBuildMode)`
| Build mode | MyIdBuildMode.PRODUCTION
...
...
@@ -150,25 +152,28 @@ Method | Notes | Default
`withOrganizationDetails(value: OrganizationDetails)`
| Custom Organization Details | Optional
`withPhoto(value: Boolean)`
| Return SDK face bitmap | false
**Note 1.1.**
`MyIdEntryType`
contains
**AUTH**
and
**FACE**
types.
-
**AUTH**
is used to identify the user through the MyID services.
-
**FACE**
is used to detect a face and returns a picture (bitmap).
**Note 1.2.**
You can customize the screen for entering passport data and date of birth in your
**Note 1.1.**
You can customize the screen for entering passport data and date of birth in your
application, in which case you can pass these parameters during initialization to the SDK, otherwise
the SDK requires the input of passport data and date of birth for user identification.
**Note 1.3.**
`MyIdBuildMode`
contains
**DEBUG**
and
**PRODUCTION**
modes.
**Note 1.2.**
If the
`sdk_hash`
is empty, blank or string with length other than 32 has been
provided, we will continue showing the credentials screen.
**Note 1.3.**
If the
`externalId`
is not empty, has a length of 36 characters and corresponds to the
regular expression UUID4, we will display a
[
recommendation
](
images/screen01.jpg
)
screen in case the
sdk detects a blurry photo.
**Note 1.4.**
`MyIdBuildMode`
contains
**DEBUG**
and
**PRODUCTION**
modes.
-
**DEBUG**
is used to sandbox.
-
**PRODUCTION**
is used to production.
**Note 1.4.**
If the externalId is not empty, has a length of 36 characters and corresponds to the
regular expression UUID4, we will display a
[
recommendation
](
images/screen01.jpg
)
screen in case the
sdk detects a blurry photo.
**Note 1.5.**
`MyIdEntryType`
contains
**AUTH**
and
**FACE**
types.
-
**AUTH**
is used to identify the user through the MyID services.
-
**FACE**
is used to detect a face and returns a picture (bitmap).
**Note 1.
5
.**
`MyIdCameraShape`
contains
**[CIRCLE](images/screen03.jpg)**
**Note 1.
6
.**
`MyIdCameraShape`
contains
**[CIRCLE](images/screen03.jpg)**
and
**[ELLIPSE](images/screen04.jpg)**
types.
### 1.2 Handling callbacks
...
...
app/build.gradle
View file @
881c66f7
...
...
@@ -49,7 +49,7 @@ dependencies {
implementation
(
"androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
)
implementation
(
"androidx.lifecycle:lifecycle-runtime-ktx:2.5.1"
)
def
cameraVersion
=
"1.
2
.0-
rc
01"
def
cameraVersion
=
"1.
3
.0-
alpha
01"
implementation
(
"androidx.camera:camera-camera2:$cameraVersion"
)
implementation
(
"androidx.camera:camera-lifecycle:$cameraVersion"
)
implementation
(
"androidx.camera:camera-view:$cameraVersion"
)
...
...
app/libs/myid-sdk-2.1.2-release.aar
View file @
881c66f7
No preview for this file type
app/src/main/java/uz/myid/sdk/sample/ExampleJavaActivity.java
View file @
881c66f7
...
...
@@ -50,6 +50,7 @@ public class ExampleJavaActivity extends AppCompatActivity implements MyIdResult
String
clientId
=
"client_id"
;
String
passportData
=
"passport_data"
;
String
dateOfBirth
=
"date_of_birth"
;
String
sdkHash
=
"sdk_hash"
;
String
externalId
=
"external_id"
;
float
threshold
=
0.5f
;
...
...
@@ -61,6 +62,7 @@ public class ExampleJavaActivity extends AppCompatActivity implements MyIdResult
MyIdConfig
myIdConfig
=
new
MyIdConfig
.
Builder
(
clientId
)
.
withPassportData
(
passportData
)
.
withBirthDate
(
dateOfBirth
)
.
withSdkHash
(
sdkHash
)
.
withExternalId
(
externalId
)
.
withThreshold
(
threshold
)
.
withBuildMode
(
MyIdBuildMode
.
PRODUCTION
)
...
...
app/src/main/java/uz/myid/sdk/sample/ExampleJavaFragment.java
View file @
881c66f7
...
...
@@ -50,6 +50,7 @@ public class ExampleJavaFragment extends Fragment implements MyIdResultListener
String
clientId
=
"client_id"
;
String
passportData
=
"passport_data"
;
String
dateOfBirth
=
"date_of_birth"
;
String
sdkHash
=
"sdk_hash"
;
String
externalId
=
"external_id"
;
float
threshold
=
0.5f
;
...
...
@@ -61,6 +62,7 @@ public class ExampleJavaFragment extends Fragment implements MyIdResultListener
MyIdConfig
myIdConfig
=
new
MyIdConfig
.
Builder
(
clientId
)
.
withPassportData
(
passportData
)
.
withBirthDate
(
dateOfBirth
)
.
withSdkHash
(
sdkHash
)
.
withExternalId
(
externalId
)
.
withThreshold
(
threshold
)
.
withBuildMode
(
MyIdBuildMode
.
PRODUCTION
)
...
...
app/src/main/java/uz/myid/sdk/sample/ExampleKotlinFragment.kt
View file @
881c66f7
...
...
@@ -31,6 +31,7 @@ class ExampleKotlinFragment : Fragment(), MyIdResultListener {
val
clientId
=
"client_id"
val
passportData
=
"passport_data"
val
dateOfBirth
=
"date_of_birth"
val
sdkHash
=
"sdk_hash"
val
externalId
=
"external_id"
val
threshold
=
0.50f
...
...
@@ -42,6 +43,7 @@ class ExampleKotlinFragment : Fragment(), MyIdResultListener {
val
myIdConfig
=
MyIdConfig
.
Builder
(
clientId
)
.
withPassportData
(
passportData
)
.
withBirthDate
(
dateOfBirth
)
.
withSdkHash
(
sdkHash
)
.
withExternalId
(
externalId
)
.
withThreshold
(
threshold
)
.
withBuildMode
(
MyIdBuildMode
.
PRODUCTION
)
...
...
app/src/main/java/uz/myid/sdk/sample/MainActivity.kt
View file @
881c66f7
...
...
@@ -104,6 +104,7 @@ class MainActivity : AppCompatActivity(), MyIdResultListener {
val
myIdConfig
=
MyIdConfig
.
builder
(
binding
.
inputClientId
.
value
)
.
withPassportData
(
binding
.
inputPassportData
.
value
)
.
withBirthDate
(
binding
.
inputDate
.
value
)
.
withSdkHash
(
binding
.
inputSdkHash
.
value
)
.
withExternalId
(
binding
.
inputExternalId
.
value
)
.
withThreshold
(
binding
.
thresholdSlider
.
value
)
.
withBuildMode
(
myIdBuildMode
)
...
...
app/src/main/res/layout/activity_main.xml
View file @
881c66f7
...
...
@@ -64,6 +64,24 @@
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
style=
"@style/Widget.Material3.TextInputLayout.OutlinedBox"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"12dp"
android:hint=
"@string/sdk_hash"
app:helperText=
"* Optional"
app:helperTextEnabled=
"true"
>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/inputSdkHash"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:importantForAutofill=
"no"
android:inputType=
"textMultiLine"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
style=
"@style/Widget.Material3.TextInputLayout.OutlinedBox"
android:layout_width=
"match_parent"
...
...
@@ -125,20 +143,20 @@
android:orientation=
"horizontal"
>
<RadioButton
android:textAllCaps=
"true"
android:id=
"@+id/radioProd"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/prod"
android:textAllCaps=
"true"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
<RadioButton
android:textAllCaps=
"true"
android:id=
"@+id/radioDev"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:text=
"@string/dev"
android:textAllCaps=
"true"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
</RadioGroup>
...
...
@@ -151,20 +169,20 @@
android:orientation=
"horizontal"
>
<RadioButton
android:textAllCaps=
"true"
android:id=
"@+id/radioAuth"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/auth"
android:textAllCaps=
"true"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
<RadioButton
android:textAllCaps=
"true"
android:id=
"@+id/radioFace"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"12dp"
android:text=
"@string/face"
android:textAllCaps=
"true"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
</RadioGroup>
...
...
@@ -177,29 +195,29 @@
android:orientation=
"horizontal"
>
<RadioButton
android:textAllCaps=
"true"
android:id=
"@+id/radioUz"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/uzbek"
android:textAllCaps=
"true"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
<RadioButton
android:textAllCaps=
"true"
android:id=
"@+id/radioEn"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"12dp"
android:text=
"@string/english"
android:textAllCaps=
"true"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
<RadioButton
android:textAllCaps=
"true"
android:id=
"@+id/radioRu"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"12dp"
android:text=
"@string/russian"
android:textAllCaps=
"true"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
</RadioGroup>
...
...
@@ -212,11 +230,11 @@
android:orientation=
"horizontal"
>
<RadioButton
android:textAllCaps=
"true"
android:id=
"@+id/radioCircle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/circle"
android:textAllCaps=
"true"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
<RadioButton
...
...
@@ -230,24 +248,24 @@
</RadioGroup>
<CheckBox
android:textAllCaps=
"true"
android:id=
"@+id/checkboxWithPhoto"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:checked=
"true"
android:text=
"@string/with_photo"
android:textAllCaps=
"true"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/buttonStart"
android:textAllCaps=
"true"
style=
"@style/Widget.Material3.Button.UnelevatedButton"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_marginTop=
"20dp"
android:text=
"@string/scan_face_data"
android:textAllCaps=
"true"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
<TextView
...
...
app/src/main/res/values/strings.xml
View file @
881c66f7
...
...
@@ -21,4 +21,5 @@
<string
name=
"uzbek"
>
Uzbek
</string>
<string
name=
"with_photo"
>
With photo
</string>
<string
name=
"without_photo"
>
Without photo
</string>
<string
name=
"sdk_hash"
>
Sdk hash
</string>
</resources>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment