The Geolocalization Service JAAK used to record the location (latitude and length) where the Session KYC. It's important to note that the location is collected from the device that the end user uses to conduct the Session KYC.
Add permission at AndroidManifes.xml
You have to apply for appropriate permission to access the location:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
If an app needs to get a background location, it also adds:
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
It adds Google Play Services's dependence on the app build.gradle.
dependencies {
implementation 'com.google.android.gms:play-services-location:21.0.1'
}
Code to get location at Kotlin
Create a feature to get user location using FusedLocationProviderClient.
import android.Manifest
import android.annotation.SuppressLint
import android.content.pm.PackageManager
import android.os.Bundle
import android.util.Log
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import com.google.android.gms.location.*
class MainActivity : AppCompatActivity() {
private lateinit var fusedLocationClient: FusedLocationProviderClient
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this)
checkLocationPermission()
}
private fun checkLocationPermission() {
when {
ContextCompat.checkSelfPermission(
this, Manifest.permission.ACCESS_FINE_LOCATION
) == PackageManager.PERMISSION_GRANTED -> {
getLastKnownLocation()
}
else -> {
requestPermissionLauncher.launch(Manifest.permission.ACCESS_FINE_LOCATION)
}
}
}
private val requestPermissionLauncher = registerForActivityResult(
ActivityResultContracts.RequestPermission()
) { isGranted: Boolean ->
if (isGranted) {
getLastKnownLocation()
} else {
Log.e("Location", "Permiso denegado")
}
}
@SuppressLint("MissingPermission")
private fun getLastKnownLocation() {
fusedLocationClient.lastLocation.addOnSuccessListener { location ->
if (location != null) {
Log.d("Location", "Latitud: ${location.latitude}, Longitud: ${location.longitude}")
} else {
Log.e("Location", "Can't get location")
}
}
}
}
Realizes next call API to register device location at Session KYC.
URL
POST https://api.sandbox.jaak.ai/api/v1/kyc/session/location
@POST("api/v1/kyc/session/location")
suspend fun locationApi(@Body request: LocationRequest): Response<LocationResponse>
Leader
Authorization: Bearer token-session-kyc
| Field | Type | Required | Description |
|---|---|---|---|
| Authorisation | string | Yeah. | The Session Token should be sent at this headquarters KYC That's been obtained from the exchange with Short Key |
Request
{
"latitude": Double,
"longitude": Double
}
data class LocationRequest(
@SerializedName("latitude") val latitude: Double,
@SerializedName("longitude") val longitude: Double
)
| Field | Type | Required | Description |
|---|---|---|---|
| latitude | double | Yeah. | Latitude of the position obtained by the device and registered at the Session KYC. |
| longitude | double | Yeah. | Length of the position obtained by the device and registered at the meeting KYC. |
Answer
{}
The Geolocalization service does not have a direct impact on the final results of the session, but it is a useful tool for data collection and sometimes, as financial, necessary to conduct its processes.
Let's continue with the next service...