Parakey SDK for Android
The Parakey SDK allows your users to access features of the Parakey ecosystem within your application.
Supported languages
English
Swedish
Norwegian
Integration with Parakey Partner API
The token bundle required to configure the SDK is available through the Parakey Partner API.
Installation
The SDK is hosted as a package in the parakey-ab/parakey-sdk-android repository. The package is public but Github authentication is still required.
Create a Personal Github access token (classic) at Github>User>Settings>Developer settings> Personal access tokens. The token needs package read access only.
Export the token along with your username in your shell configuration file (e.g. .zshrc)
export GITHUB_USER=<your username>
export GITHUB_TOKEN=<your personal access token>Content copied to clipboardAdd the Github as a maven repository in the root level
build.gradleallprojects {
repositories {
google()
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/parakey-ab/parakey-sdk-android")
credentials {
username = System.getenv("GITHUB_USER")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}Content copied to clipboardAdd a dependency on the SDK in your module level
build.gradle:dependencies {
implementation 'co.parakey:sdk:<latest version>'
}Content copied to clipboardThe latest version can be found under Packages in the Github repo. Beta versions are not recommended for production use.
Example usage
class App : Application() {
override fun onCreate() {
super.onCreate()
Parakey.initialize(this)
MainScope().launch {
val tokenBundle = findTokenBundle()
var error = Parakey.configure(tokenBundle)
if (error == null) {
error = Parakey.showScan()
}
if (error != null) {
// handle ParakeyError
}
}
}
private suspend fun findTokenBundle(): String {
// fetch token bundle from Parakey API or from local storage
}
}