Skip to content

pynicolas/fairscan-intent-sample

Repository files navigation

FairScan Intent Sample

A minimal Android application demonstrating how to invoke FairScan using an implicit intent.

This project is meant as a simple reference or testing playground for integrating with FairScan from other apps.

What it does

  • Creates an intent with the action: org.fairscan.app.action.SCAN_TO_PDF
  • Launches FairScan using registerForActivityResult
  • Retrieves the PDF returned by FairScan and saves it locally
  • Shows a fallback message if FairScan is not installed

Useful to experiment with integration behavior and how Android resolves implicit intents.

How the intent is invoked

val launcher = registerForActivityResult(
    ActivityResultContracts.StartActivityForResult()
) { result ->
    when (result.resultCode) {
        RESULT_OK -> {
            val uri = result.data?.data ?: return@registerForActivityResult
            // Save the content of the PDF pointed by uri
         }
        RESULT_CANCELED -> { /* User cancelled the scan */ }
        else -> {}
    }
}

val scanIntent = Intent("org.fairscan.app.action.SCAN_TO_PDF")
try {
    launcher.launch(scanIntent)
} catch(_: ActivityNotFoundException) {
    // Fairscan not found: show a message to the user
}

See the code for MainActivity.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages