Integration with Mobile App
Androidintegration

Integration Android Client

Option1. Let user go to deep link to AUTHBLUE App

Following Jetpack compose program will deep link from your app to AUTHBLUE Mobile Tutorial.

For full example, go to repository

https://github.com/kenmaro3/authblue-android-client-example (opens in a new tab)

ClickLinkScreen.kt
package com.example.authblueclient.View
 
import android.content.Intent
import android.net.Uri
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.style.TextAlign
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.example.authblueclient.Util.BarcodeScanner
import kotlinx.coroutines.launch
 
@Composable
fun ClickLinkScreen(
) {
    val context = LocalContext.current
    val url = remember {
        mutableStateOf("https://authblueprod.page.link/agreement?client_name=TestClient1&client_id=vGSKhQRk0aSzVB1HJ2TlZLmk&query_id=1&uid=8b1bc946-9a12-4ef9-80b1-cac7a01d35bb\n")
    }
 
    Box(
        contentAlignment = Alignment.Center
    ) {
        Button(
            modifier = Modifier
                .fillMaxWidth(.70f),
            colors = ButtonDefaults.buttonColors(
                containerColor = Color.Black
            ),
            onClick = {
                val urlIntent = Intent(
                    Intent.ACTION_VIEW,
                    Uri.parse(url.value)
                )
                context.startActivity(urlIntent)
 
            }) {
            Text(
                text = "Open Link",
                textAlign = TextAlign.Center,
                style = MaterialTheme.typography.displayMedium,
                //color = lightestGray,
                //style = TextStyle(fontWeight = FontWeight.Bold)
            )
        }
    }
}

Option2. Let user scan QR code issued by AUTHBLUE Console

In stead of have a hard coded link in your app,
you can also create QR Scanner to let user access deep link via QR scanning.

QRScanScreen.kt
package com.example.authblueclient.View
 
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.example.authblueclient.Util.BarcodeScanner
import kotlinx.coroutines.launch
 
 
@Composable
fun QRScanScreen(
) {
    lateinit var barcodeScanner: BarcodeScanner
 
    val context = LocalContext.current
    barcodeScanner = BarcodeScanner(context)
 
    val barcodeResults =
        barcodeScanner.barCodeResults.collectAsStateWithLifecycle()
 
    ScanBarcode(
        barcodeScanner::startScan,
        barcodeResults.value
    )
}
 
@Composable
private fun ScanBarcode(
    onScanBarcode: suspend () -> Unit,
    barcodeValue: String?
) {
    val scope = rememberCoroutineScope()
 
    Column(
        modifier = Modifier
            .fillMaxSize(),
        horizontalAlignment = Alignment.CenterHorizontally,
        verticalArrangement = Arrangement.Center
    ) {
 
        Button(
            modifier = Modifier
                .fillMaxWidth(.70f),
            colors = ButtonDefaults.buttonColors(
                containerColor = Color.Black
            ),
            onClick = {
                scope.launch {
                    onScanBarcode()
                }
            }) {
            Text(
                text = "Scan Barcode",
                textAlign = TextAlign.Center,
                style = MaterialTheme.typography.displayMedium,
                //color = lightestGray,
                //style = TextStyle(fontWeight = FontWeight.Bold)
            )
        }
 
        Spacer(modifier = Modifier.height(20.dp))
 
        Text(
            text = barcodeValue ?: "0000000000",
            style = MaterialTheme.typography.displayMedium
        )
 
    }
}
 

Full example is in following link.

https://github.com/kenmaro3/authblue-android-client-example/blob/main/app/src/main/java/com/example/authblueclient/View/QRScanScreen.kt (opens in a new tab)