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
b89a8a42
Commit
b89a8a42
authored
Nov 02, 2023
by
Javokhir
Browse files
2.2.7
parent
bc38de4a
Changes
11
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
b89a8a42
...
...
@@ -2,10 +2,20 @@
All notable changes to this project will be documented in this file.
## [2.2.7] - 2 Nov, 2023
-
Added new
`withMinAge(value: Int)`
method for the minimum age to use the MyID service.
-
🔨 Fixed PINFL bug on versions below Android 8.1.
-
Added error texts in inputs.
## [2.2.6] - 22 Oct, 2023
-
Added new
`withScreenOrientation(value: MyIdScreenOrientation)`
method for screen orientation.
## [2.2.5] - 19 Oct, 2023
-
🔐 Added enhanced security measures
-
Added
`withClientHash`
method, which is mandatory if using withEntryType(AUTH)
-
🔐 Added enhanced security measures
.
-
Added
`withClientHash`
method, which is mandatory if using withEntryType(
MyIdEntryType.
AUTH)
.
## [2.2.4] - 20 Sep, 2023
...
...
CUSTOMIZATION.md
View file @
b89a8a42
...
...
@@ -36,8 +36,6 @@ You can define custom colors inside your own `colors.xml` file:
*
`myidColorPrimary`
: Defines the color of SDK which guides the user through the flow
*
`myidColorSecondary`
: Defines the color of the frames
*
`myidColorError`
: Defines the color of the error buttons, icons and states
*
`myidPrimaryButtonColor`
: Defines the background color of the primary action buttons
...
...
README.md
View file @
b89a8a42
...
...
@@ -45,7 +45,7 @@ repositories {
}
dependencies
{
implementation
(
"uz.myid.sdk.capture:myid-capture-sdk:2.2.
5
"
)
implementation
(
"uz.myid.sdk.capture:myid-capture-sdk:2.2.
7
"
)
}
```
...
...
@@ -67,7 +67,7 @@ Add following lines to the **_AndroidManifest.xml_**:
```
kotlin
class
ExampleActivity
:
AppCompatActivity
(),
MyIdResultListener
{
private
val
myIdC
lient
=
MyIdClient
()
private
val
c
lient
=
MyIdClient
()
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
...
...
@@ -80,25 +80,14 @@ class ExampleActivity : AppCompatActivity(), MyIdResultListener {
logo
=
R
.
drawable
.
image_logo
)
val
myIdC
onfig
=
MyIdConfig
.
builder
(
clientId
=
/* Your client id */
)
val
c
onfig
=
MyIdConfig
.
builder
(
clientId
=
/* Your client id */
)
.
withClientHash
(
/* Your clientHash */, /* Your clientHashId */
)
.
withPassportData
(
passportData
)
.
withBirthDate
(
dateOfBirth
)
.
withSdkHash
(
sdkHash
)
.
withExternalId
(
externalId
)
.
withThreshold
(
threshold
)
.
withBuildMode
(
MyIdBuildMode
.
PRODUCTION
)
.
withEntryType
(
MyIdEntryType
.
AUTH
)
.
withResidency
(
MyIdResidentType
.
RESIDENT
)
.
withLocale
(
Locale
(
"en"
))
.
withCameraShape
(
MyIdCameraShape
.
CIRCLE
)
.
withResolution
(
MyIdResolution
.
RESOLUTION_480
)
.
withImageFormat
(
MyIdImageFormat
.
PNG
)
.
withOrganizationDetails
(
organizationDetails
)
.
withPhoto
(
false
)
.
build
()
val
intent
=
client
.
createIntent
(
activity
=
this
,
myIdConfig
=
myIdC
onfig
)
val
intent
=
client
.
createIntent
(
activity
=
this
,
c
onfig
)
result
.
launch
(
intent
)
}
...
...
@@ -111,7 +100,7 @@ class ExampleActivity : AppCompatActivity(), MyIdResultListener {
```
kotlin
class
ExampleActivity
:
AppCompatActivity
(),
MyIdResultListener
{
private
val
myIdC
lient
=
MyIdClient
()
private
val
c
lient
=
MyIdClient
()
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
...
...
@@ -120,7 +109,7 @@ class ExampleActivity : AppCompatActivity(), MyIdResultListener {
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
myIdC
lient
.
handleActivityResult
(
resultCode
,
this
)
c
lient
.
handleActivityResult
(
resultCode
,
this
)
}
private
fun
startMyId
()
{
...
...
@@ -129,22 +118,11 @@ class ExampleActivity : AppCompatActivity(), MyIdResultListener {
logo
=
R
.
drawable
.
image_logo
)
val
myIdC
onfig
=
MyIdConfig
.
builder
(
clientId
=
/* Your client id */
)
val
c
onfig
=
MyIdConfig
.
builder
(
clientId
=
/* Your client id */
)
.
withClientHash
(
/* Your clientHash */, /* Your clientHashId */
)
.
withPassportData
(
passportData
)
.
withBirthDate
(
dateOfBirth
)
.
withSdkHash
(
sdkHash
)
.
withExternalId
(
externalId
)
.
withThreshold
(
threshold
)
.
withBuildMode
(
MyIdBuildMode
.
PRODUCTION
)
.
withEntryType
(
MyIdEntryType
.
AUTH
)
.
withResidency
(
MyIdResidentType
.
RESIDENT
)
.
withLocale
(
Locale
(
"en"
))
.
withCameraShape
(
MyIdCameraShape
.
CIRCLE
)
.
withResolution
(
MyIdResolution
.
RESOLUTION_480
)
.
withImageFormat
(
MyIdImageFormat
.
PNG
)
.
withOrganizationDetails
(
organizationDetails
)
.
withPhoto
(
false
)
.
build
()
/*
...
...
@@ -152,7 +130,7 @@ class ExampleActivity : AppCompatActivity(), MyIdResultListener {
Must be an Activity or Fragment (support library).
This request code will be important for you on onActivityResult() to identify the MyIdResultListener.
*/
myIdC
lient
.
startActivityForResult
(
this
,
1
,
myIdC
onfig
)
c
lient
.
startActivityForResult
(
this
,
1
,
c
onfig
)
}
}
```
...
...
@@ -163,16 +141,18 @@ Method | Notes | Default
--- | --- | ---
`withClientHash(clientHash: String, clientHashId: String)`
| Provided by MyID sales team | Mandatory, if using withEntryType(MyIdEntryType.AUTH)
`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
`withBirthDate(value: String)`
| Date of birth. Format:
`dd.MM.yyyy`
| Optional
`withMinAge(value: Int)`
| To set a specific minimum age to use MyID service | 16
`withSdkHash(value: String)`
| 32 characters long string (Note 1.2) | 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
`withEntryType(value: MyIdEntryType)`
| Customizing the SDK Entry types | MyIdEntryType.AUTH
`withBuildMode(value: MyIdBuildMode)`
| Build mode
(Note 1.4)
| MyIdBuildMode.PRODUCTION
`withEntryType(value: MyIdEntryType)`
| Customizing the SDK Entry types
(Note 1.5)
| MyIdEntryType.AUTH
`withResidency(value: MyIdResidentType)`
| To set a specific resident type | MyIdResidentType.RESIDENT
`withLocale(value: Locale)`
| To set a specific locale | Locale("uz")
`withCameraShape(value: MyIdCameraShape)`
| To set a specific camera shape | MyIdCameraShape.CIRCLE
`withCameraShape(value: MyIdCameraShape)`
| To set a specific camera shape
(Note 1.6)
| MyIdCameraShape.CIRCLE
`withResolution(value: MyIdResolution)`
| To set a specific camera resolution | MyIdResolution.RESOLUTION_480
`withScreenOrientation(value: MyIdScreenOrientation)`
| To set a specific screen orientation | MyIdScreenOrientation.FULL
`withImageFormat(value: MyIdImageFormat)`
| To set a specific image format | MyIdImageFormat.PNG
`withOrganizationDetails(value: MyIdOrganizationDetails)`
| Custom Organization Details | Optional
`withPhoto(value: Boolean)`
| Return SDK face bitmap | false
...
...
@@ -204,7 +184,7 @@ and **[ELLIPSE](images/screen04.jpg)** types.
### 1.2 Handling callbacks
```
kotlin
val
myIdR
esultListener
:
MyIdResultListener
=
object
:
MyIdResultListener
{
val
r
esultListener
:
MyIdResultListener
=
object
:
MyIdResultListener
{
override
fun
onSuccess
(
result
:
MyIdResult
)
{
// Get face bitmap and result code
...
...
app/build.gradle
View file @
b89a8a42
...
...
@@ -35,5 +35,5 @@ android {
dependencies
{
implementation
(
"com.google.android.material:material:1.10.0"
)
implementation
(
"uz.myid.sdk.capture:myid-capture-sdk:2.2.
5
"
)
implementation
(
"uz.myid.sdk.capture:myid-capture-sdk:2.2.
7
"
)
}
\ No newline at end of file
app/src/main/java/uz/myid/sdk/sample/ExampleJavaActivity.java
View file @
b89a8a42
...
...
@@ -9,23 +9,16 @@ import androidx.activity.result.ActivityResultLauncher;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.app.AppCompatActivity
;
import
java.util.Locale
;
import
uz.myid.android.sdk.capture.MyIdClient
;
import
uz.myid.android.sdk.capture.MyIdConfig
;
import
uz.myid.android.sdk.capture.MyIdException
;
import
uz.myid.android.sdk.capture.MyIdResult
;
import
uz.myid.android.sdk.capture.MyIdResultListener
;
import
uz.myid.android.sdk.capture.model.MyIdBuildMode
;
import
uz.myid.android.sdk.capture.model.MyIdCameraShape
;
import
uz.myid.android.sdk.capture.model.MyIdEntryType
;
import
uz.myid.android.sdk.capture.model.MyIdImageFormat
;
import
uz.myid.android.sdk.capture.model.MyIdResidentType
;
import
uz.myid.android.sdk.capture.model.MyIdResolution
;
public
class
ExampleJavaActivity
extends
AppCompatActivity
implements
MyIdResultListener
{
private
final
MyIdClient
myIdC
lient
=
new
MyIdClient
();
private
final
MyIdClient
c
lient
=
new
MyIdClient
();
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -50,29 +43,19 @@ public class ExampleJavaActivity extends AppCompatActivity implements MyIdResult
private
void
startMyId
()
{
String
clientId
=
"client_id"
;
String
clientHash
=
"client_hash"
;
String
clientHashId
=
"client_hash_id"
;
String
passportData
=
"passport_data"
;
String
dateOfBirth
=
"date_of_birth"
;
String
sdkHash
=
"sdk_hash"
;
String
externalId
=
"external_id"
;
float
threshold
=
0.5f
;
MyIdConfig
myIdConfig
=
new
MyIdConfig
.
Builder
(
clientId
)
MyIdConfig
config
=
new
MyIdConfig
.
Builder
(
clientId
)
.
withClientHash
(
clientHash
,
clientHashId
)
.
withPassportData
(
passportData
)
.
withBirthDate
(
dateOfBirth
)
.
withSdkHash
(
sdkHash
)
.
withExternalId
(
externalId
)
.
withThreshold
(
threshold
)
.
withBuildMode
(
MyIdBuildMode
.
PRODUCTION
)
.
withEntryType
(
MyIdEntryType
.
AUTH
)
.
withResidency
(
MyIdResidentType
.
RESIDENT
)
.
withLocale
(
new
Locale
(
"en"
))
.
withCameraShape
(
MyIdCameraShape
.
CIRCLE
)
.
withResolution
(
MyIdResolution
.
RESOLUTION_480
)
.
withImageFormat
(
MyIdImageFormat
.
PNG
)
.
withPhoto
(
false
)
.
build
();
Intent
intent
=
myIdC
lient
.
createIntent
(
this
,
myIdC
onfig
);
Intent
intent
=
c
lient
.
createIntent
(
this
,
c
onfig
);
result
.
launch
(
intent
);
}
...
...
app/src/main/java/uz/myid/sdk/sample/ExampleJavaFragment.java
View file @
b89a8a42
...
...
@@ -25,7 +25,7 @@ import uz.myid.android.sdk.capture.model.MyIdResolution;
public
class
ExampleJavaFragment
extends
Fragment
implements
MyIdResultListener
{
private
final
MyIdClient
myIdC
lient
=
new
MyIdClient
();
private
final
MyIdClient
c
lient
=
new
MyIdClient
();
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -50,29 +50,19 @@ public class ExampleJavaFragment extends Fragment implements MyIdResultListener
private
void
startMyId
()
{
String
clientId
=
"client_id"
;
String
clientHash
=
"client_hash"
;
String
clientHashId
=
"client_hash_id"
;
String
passportData
=
"passport_data"
;
String
dateOfBirth
=
"date_of_birth"
;
String
sdkHash
=
"sdk_hash"
;
String
externalId
=
"external_id"
;
float
threshold
=
0.5f
;
MyIdConfig
myIdConfig
=
new
MyIdConfig
.
Builder
(
clientId
)
MyIdConfig
config
=
new
MyIdConfig
.
Builder
(
clientId
)
.
withClientHash
(
clientHash
,
clientHashId
)
.
withPassportData
(
passportData
)
.
withBirthDate
(
dateOfBirth
)
.
withSdkHash
(
sdkHash
)
.
withExternalId
(
externalId
)
.
withThreshold
(
threshold
)
.
withBuildMode
(
MyIdBuildMode
.
PRODUCTION
)
.
withEntryType
(
MyIdEntryType
.
AUTH
)
.
withResidency
(
MyIdResidentType
.
RESIDENT
)
.
withLocale
(
new
Locale
(
"en"
))
.
withCameraShape
(
MyIdCameraShape
.
CIRCLE
)
.
withResolution
(
MyIdResolution
.
RESOLUTION_480
)
.
withImageFormat
(
MyIdImageFormat
.
PNG
)
.
withPhoto
(
false
)
.
build
();
Intent
intent
=
myIdC
lient
.
createIntent
(
requireActivity
(),
myIdC
onfig
);
Intent
intent
=
c
lient
.
createIntent
(
requireActivity
(),
c
onfig
);
result
.
launch
(
intent
);
}
...
...
app/src/main/java/uz/myid/sdk/sample/ExampleKotlinFragment.kt
View file @
b89a8a42
...
...
@@ -2,13 +2,17 @@ package uz.myid.sdk.sample
import
android.os.Bundle
import
androidx.fragment.app.Fragment
import
uz.myid.android.sdk.capture.*
import
uz.myid.android.sdk.capture.model.*
import
java.util.*
import
uz.myid.android.sdk.capture.MyIdClient
import
uz.myid.android.sdk.capture.MyIdConfig
import
uz.myid.android.sdk.capture.MyIdException
import
uz.myid.android.sdk.capture.MyIdResult
import
uz.myid.android.sdk.capture.MyIdResultListener
import
uz.myid.android.sdk.capture.model.MyIdBuildMode
import
uz.myid.android.sdk.capture.takeUserResult
class
ExampleKotlinFragment
:
Fragment
(),
MyIdResultListener
{
private
val
myIdC
lient
=
MyIdClient
()
private
val
c
lient
=
MyIdClient
()
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
...
...
@@ -29,34 +33,19 @@ class ExampleKotlinFragment : Fragment(), MyIdResultListener {
private
fun
startMyId
()
{
val
clientId
=
"client_id"
val
clientHash
=
"client_hash"
val
clientHashId
=
"client_hash_id"
val
passportData
=
"passport_data"
val
dateOfBirth
=
"date_of_birth"
val
sdkHash
=
"sdk_hash"
val
externalId
=
"external_id"
val
threshold
=
0.50f
val
organizationDetails
=
MyIdOrganizationDetails
(
phoneNumber
=
"1234567"
,
)
val
myIdConfig
=
MyIdConfig
.
Builder
(
clientId
)
val
config
=
MyIdConfig
.
Builder
(
clientId
)
.
withClientHash
(
clientHash
,
clientHashId
)
.
withPassportData
(
passportData
)
.
withBirthDate
(
dateOfBirth
)
.
withSdkHash
(
sdkHash
)
.
withExternalId
(
externalId
)
.
withThreshold
(
threshold
)
.
withBuildMode
(
MyIdBuildMode
.
PRODUCTION
)
.
withEntryType
(
MyIdEntryType
.
AUTH
)
.
withResidency
(
MyIdResidentType
.
RESIDENT
)
.
withLocale
(
Locale
(
"en"
))
.
withCameraShape
(
MyIdCameraShape
.
CIRCLE
)
.
withResolution
(
MyIdResolution
.
RESOLUTION_480
)
.
withImageFormat
(
MyIdImageFormat
.
PNG
)
.
withOrganizationDetails
(
organizationDetails
)
.
withPhoto
(
false
)
.
build
()
val
intent
=
myIdC
lient
.
createIntent
(
requireActivity
(),
myIdC
onfig
)
val
intent
=
c
lient
.
createIntent
(
requireActivity
(),
c
onfig
)
result
.
launch
(
intent
)
}
...
...
app/src/main/java/uz/myid/sdk/sample/ExampleWithOnActivityResultActivity.kt
View file @
b89a8a42
...
...
@@ -3,13 +3,16 @@ package uz.myid.sdk.sample
import
android.content.Intent
import
android.os.Bundle
import
androidx.appcompat.app.AppCompatActivity
import
uz.myid.android.sdk.capture.*
import
uz.myid.android.sdk.capture.model.*
import
java.util.*
import
uz.myid.android.sdk.capture.MyIdClient
import
uz.myid.android.sdk.capture.MyIdConfig
import
uz.myid.android.sdk.capture.MyIdException
import
uz.myid.android.sdk.capture.MyIdResult
import
uz.myid.android.sdk.capture.MyIdResultListener
import
uz.myid.android.sdk.capture.model.MyIdBuildMode
class
ExampleWithOnActivityResultActivity
:
AppCompatActivity
(),
MyIdResultListener
{
private
val
myIdC
lient
=
MyIdClient
()
private
val
c
lient
=
MyIdClient
()
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
...
...
@@ -18,7 +21,7 @@ class ExampleWithOnActivityResultActivity : AppCompatActivity(), MyIdResultListe
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
myIdC
lient
.
handleActivityResult
(
resultCode
,
this
)
c
lient
.
handleActivityResult
(
resultCode
,
this
)
}
override
fun
onSuccess
(
result
:
MyIdResult
)
{
...
...
@@ -35,31 +38,16 @@ class ExampleWithOnActivityResultActivity : AppCompatActivity(), MyIdResultListe
private
fun
startMyId
()
{
val
clientId
=
"client_id"
val
clientHash
=
"client_hash"
val
clientHashId
=
"client_hash_id"
val
passportData
=
"passport_data"
val
dateOfBirth
=
"date_of_birth"
val
sdkHash
=
"sdk_hash"
val
externalId
=
"external_id"
val
threshold
=
0.50f
val
organizationDetails
=
MyIdOrganizationDetails
(
phoneNumber
=
"1234567"
,
)
val
myIdConfig
=
MyIdConfig
.
Builder
(
clientId
)
val
config
=
MyIdConfig
.
Builder
(
clientId
)
.
withClientHash
(
clientHash
,
clientHashId
)
.
withPassportData
(
passportData
)
.
withBirthDate
(
dateOfBirth
)
.
withSdkHash
(
sdkHash
)
.
withExternalId
(
externalId
)
.
withThreshold
(
threshold
)
.
withBuildMode
(
MyIdBuildMode
.
PRODUCTION
)
.
withEntryType
(
MyIdEntryType
.
AUTH
)
.
withResidency
(
MyIdResidentType
.
RESIDENT
)
.
withLocale
(
Locale
(
"en"
))
.
withCameraShape
(
MyIdCameraShape
.
CIRCLE
)
.
withResolution
(
MyIdResolution
.
RESOLUTION_480
)
.
withImageFormat
(
MyIdImageFormat
.
PNG
)
.
withOrganizationDetails
(
organizationDetails
)
.
withPhoto
(
false
)
.
build
()
/*
...
...
@@ -67,6 +55,6 @@ class ExampleWithOnActivityResultActivity : AppCompatActivity(), MyIdResultListe
Must be an Activity or Fragment (support library).
This request code will be important for you on onActivityResult() to identify the MyIdResultListener.
*/
myIdC
lient
.
startActivityForResult
(
this
,
1
,
myIdC
onfig
)
c
lient
.
startActivityForResult
(
this
,
1
,
c
onfig
)
}
}
\ No newline at end of file
app/src/main/java/uz/myid/sdk/sample/MainActivity.kt
View file @
b89a8a42
...
...
@@ -9,15 +9,8 @@ import uz.myid.android.sdk.capture.MyIdException
import
uz.myid.android.sdk.capture.MyIdResult
import
uz.myid.android.sdk.capture.MyIdResultListener
import
uz.myid.android.sdk.capture.model.MyIdBuildMode
import
uz.myid.android.sdk.capture.model.MyIdCameraShape
import
uz.myid.android.sdk.capture.model.MyIdEntryType
import
uz.myid.android.sdk.capture.model.MyIdImageFormat
import
uz.myid.android.sdk.capture.model.MyIdOrganizationDetails
import
uz.myid.android.sdk.capture.model.MyIdResidentType
import
uz.myid.android.sdk.capture.model.MyIdResolution
import
uz.myid.android.sdk.capture.takeUserResult
import
uz.myid.sdk.sample.databinding.ActivityMainBinding
import
java.util.Locale
class
MainActivity
:
AppCompatActivity
(),
MyIdResultListener
{
...
...
@@ -26,39 +19,12 @@ class MainActivity : AppCompatActivity(), MyIdResultListener {
private
val
client
=
MyIdClient
()
private
var
buildMode
=
MyIdBuildMode
.
PRODUCTION
private
var
entryType
=
MyIdEntryType
.
AUTH
private
var
residency
=
MyIdResidentType
.
RESIDENT
private
var
locale
=
Locale
(
"en"
)
private
var
shape
=
MyIdCameraShape
.
CIRCLE
private
var
code
=
""
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setContentView
(
binding
.
root
)
with
(
binding
)
{
radioGroupLang
.
setOnCheckedChangeListener
{
_
,
checkedId
->
locale
=
when
(
checkedId
)
{
R
.
id
.
radioUz
->
Locale
(
"uz"
)
R
.
id
.
radioEn
->
Locale
(
"en"
)
else
->
Locale
(
"ru"
)
}
}
radioGroupEntryType
.
setOnCheckedChangeListener
{
_
,
checkedId
->
entryType
=
if
(
checkedId
==
R
.
id
.
radioFace
)
{
MyIdEntryType
.
FACE
}
else
{
MyIdEntryType
.
AUTH
}
}
radioGroupResidentType
.
setOnCheckedChangeListener
{
_
,
checkedId
->
residency
=
when
(
checkedId
)
{
R
.
id
.
radioManual
->
MyIdResidentType
.
USER_DEFINED
R
.
id
.
radioNonResident
->
MyIdResidentType
.
NON_RESIDENT
else
->
MyIdResidentType
.
RESIDENT
}
}
radioGroupBuildMode
.
setOnCheckedChangeListener
{
_
,
checkedId
->
buildMode
=
if
(
checkedId
==
R
.
id
.
radioProd
)
{
MyIdBuildMode
.
PRODUCTION
...
...
@@ -66,21 +32,12 @@ class MainActivity : AppCompatActivity(), MyIdResultListener {
MyIdBuildMode
.
DEBUG
}
}
radioGroupShape
.
setOnCheckedChangeListener
{
_
,
checkedId
->
shape
=
if
(
checkedId
==
R
.
id
.
radioCircle
)
{
MyIdCameraShape
.
CIRCLE
}
else
{
MyIdCameraShape
.
ELLIPSE
}
}
buttonStart
.
setOnClickListener
{
startMyId
()
}
}
}
override
fun
onSuccess
(
result
:
MyIdResult
)
{
code
=
result
.
code
.
orEmpty
()
with
(
binding
)
{
imageResult
.
setImageBitmap
(
result
.
bitmap
)
"""
...
...
@@ -91,8 +48,6 @@ class MainActivity : AppCompatActivity(), MyIdResultListener {
}
override
fun
onError
(
e
:
MyIdException
)
{
code
=
""
with
(
binding
)
{
imageResult
.
setImageBitmap
(
null
)
"""
...
...
@@ -103,8 +58,6 @@ class MainActivity : AppCompatActivity(), MyIdResultListener {
}
override
fun
onUserExited
()
{
code
=
""
with
(
binding
)
{
imageResult
.
setImageBitmap
(
null
)
"User exited sdk"
.
also
{
textResult
.
text
=
it
}
...
...
@@ -112,10 +65,6 @@ class MainActivity : AppCompatActivity(), MyIdResultListener {
}
private
fun
startMyId
()
{
val
organizationDetails
=
MyIdOrganizationDetails
(
phoneNumber
=
binding
.
inputPhoneNumber
.
value
)
val
config
=
MyIdConfig
.
builder
(
binding
.
inputClientId
.
value
)
.
withClientHash
(
clientHash
=
binding
.
inputClientHash
.
value
,
...
...
@@ -123,18 +72,7 @@ class MainActivity : AppCompatActivity(), MyIdResultListener {
)
.
withPassportData
(
binding
.
inputPassportData
.
value
)
.
withBirthDate
(
binding
.
inputDate
.
value
)
.
withSdkHash
(
binding
.
inputSdkHash
.
value
)
.
withExternalId
(
binding
.
inputExternalId
.
value
)
.
withThreshold
(
binding
.
thresholdSlider
.
value
)
.
withBuildMode
(
buildMode
)
.
withEntryType
(
entryType
)
.
withResidency
(
residency
)
.
withLocale
(
locale
)
.
withCameraShape
(
shape
)
.
withOrganizationDetails
(
organizationDetails
)
.
withResolution
(
MyIdResolution
.
RESOLUTION_480
)
.
withImageFormat
(
MyIdImageFormat
.
PNG
)
.
withPhoto
(
binding
.
checkboxWithPhoto
.
isChecked
)
.
build
()
val
intent
=
client
.
createIntent
(
this
,
config
)
...
...
app/src/main/res/layout/activity_main.xml
View file @
b89a8a42
...
...
@@ -100,76 +100,6 @@
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"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"12dp"
android:hint=
"@string/external_id"
app:helperText=
"* Optional"
app:helperTextEnabled=
"true"
>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/inputExternalId"
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"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"12dp"
android:hint=
"@string/organization_phone_number"
app:helperText=
"* Optional"
app:helperTextEnabled=
"true"
>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/inputPhoneNumber"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:importantForAutofill=
"no"
android:inputType=
"phone"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:text=
"@string/threshold"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
<com.google.android.material.slider.Slider
android:id=
"@+id/thresholdSlider"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:stepSize=
"0.01"
android:valueFrom=
"0.50"
android:valueTo=
"0.99"
app:labelBehavior=
"floating"
/>
<RadioGroup
android:id=
"@+id/radioGroupBuildMode"
android:layout_width=
"wrap_content"
...
...
@@ -194,127 +124,6 @@
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
</RadioGroup>
<RadioGroup
android:id=
"@+id/radioGroupEntryType"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:checkedButton=
"@id/radioAuth"
android:orientation=
"horizontal"
>
<RadioButton
android:id=
"@+id/radioAuth"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/auth"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
<RadioButton
android:id=
"@+id/radioFace"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"12dp"
android:text=
"@string/face"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
</RadioGroup>
<RadioGroup
android:id=
"@+id/radioGroupResidentType"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:checkedButton=
"@id/radioResident"
android:orientation=
"horizontal"
>
<RadioButton
android:id=
"@+id/radioManual"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/manual"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
<RadioButton
android:id=
"@+id/radioResident"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"12dp"
android:text=
"@string/resident"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
<RadioButton
android:id=
"@+id/radioNonResident"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"12dp"
android:text=
"@string/non_resident"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
</RadioGroup>
<RadioGroup
android:id=
"@+id/radioGroupLang"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:checkedButton=
"@id/radioEn"
android:orientation=
"horizontal"
>
<RadioButton
android:id=
"@+id/radioUz"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/uzbek"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
<RadioButton
android:id=
"@+id/radioEn"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"12dp"
android:text=
"@string/english"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
<RadioButton
android:id=
"@+id/radioRu"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"12dp"
android:text=
"@string/russian"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
</RadioGroup>
<RadioGroup
android:id=
"@+id/radioGroupShape"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:checkedButton=
"@id/radioCircle"
android:orientation=
"horizontal"
>
<RadioButton
android:id=
"@+id/radioCircle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/circle"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
<RadioButton
android:id=
"@+id/radioEllipse"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"12dp"
android:text=
"@string/ellipse"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
</RadioGroup>
<CheckBox
android:id=
"@+id/checkboxWithPhoto"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:checked=
"false"
android:text=
"@string/with_photo"
android:textAppearance=
"@style/TextAppearance.Material3.BodyLarge"
/>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/buttonStart"
style=
"@style/Widget.Material3.Button.UnelevatedButton"
...
...
@@ -344,6 +153,6 @@
android:layout_width=
"200dp"
android:layout_height=
"200dp"
android:layout_marginTop=
"16dp"
android:
contentDescription=
"@string/image
"
/>
android:
importantForAccessibility=
"no
"
/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
b89a8a42
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<resources>
<string
name=
"app_name"
>
MyID Sample
</string>
<string
name=
"auth"
>
Auth
</string>
<string
name=
"birth_date"
>
Birth date
</string>
<string
name=
"circle"
>
Circle
</string>
<string
name=
"client_id"
>
Client ID
</string>
<string
name=
"client_hash"
>
Client hash
</string>
<string
name=
"client_hash_id"
>
Client hash ID
</string>
<string
name=
"dev"
>
Dev
</string>
<string
name=
"ellipse"
>
Ellipse
</string>
<string
name=
"english"
>
English
</string>
<string
name=
"external_id"
>
External id
</string>
<string
name=
"face"
>
Face
</string>
<string
name=
"image"
>
Image
</string>
<string
name=
"manual"
>
Manual
</string>
<string
name=
"non_resident"
>
Non resident
</string>
<string
name=
"organization_phone_number"
>
Phone number
</string>
<string
name=
"passport"
>
Passport or PINFL
</string>
<string
name=
"prod"
>
Prod
</string>
<string
name=
"resident"
>
Resident
</string>
<string
name=
"result_image"
>
Result image
</string>
<string
name=
"russian"
>
Russian
</string>
<string
name=
"scan_face_data"
>
Scan face data
</string>
<string
name=
"sdk_hash"
>
Sdk hash
</string>
<string
name=
"threshold"
>
Threshold
</string>
<string
name=
"uzbek"
>
Uzbek
</string>
<string
name=
"with_photo"
>
With photo
</string>
<string
name=
"without_photo"
>
Without photo
</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