Giter VIP home page Giter VIP logo

veryfi-android's Introduction

License: MIT code coverage

veryfi is a Android module for communicating with the Veryfi OCR API

Installation

Install from Maven, a package manager for Java.

Add in your project build.gradle file the veryfi android SDK dependency:

dependencies {
    implementation 'com.veryfi:veryfi-android:1.0.8'
}

Getting Started

Obtaining Client ID and user keys

If you don't have an account with Veryfi, please go ahead and register here: https://hub.veryfi.com/signup/api/

Android API Client Library

The veryfi library can be used to communicate with Veryfi API. All available functionality is described here https://veryfi.github.io/veryfi-android/android/com.veryfi.android/-client/index.html

Below is the sample kotlin script using veryfi to OCR and extract data from a document:

Create a basic layout with a TextView to set the response

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <TextView
        android:id="@+id/response"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#535353"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

Process a document

class MainActivity : AppCompatActivity() {

    var clientId = "your_client_id"
    var clientSecret = "your_client_secret"
    var username = "your_username"
    var apiKey = "your_password"

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val client = VeryfiClientFactory.createClient(clientId, clientSecret, username, apiKey)
        val categories = listOf("Advertising & Marketing", "Automotive")
        val fileName = "example1.jpg"
        client.processDocument(assets.open(fileName), fileName, categories, false, null, { jsonString ->
            //Update UI with jsonString response
            findViewById<TextView>(R.id.response).text = jsonString
        }, { errorMessage ->
            //handle errorMessage
        })
    }
}

Update a document

class MainActivity : AppCompatActivity() {

    var clientId = "your_client_id"
    var clientSecret = "your_client_secret"
    var username = "your_username"
    var apiKey = "your_password"

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        setContentView(R.layout.activity_main)
        val documentId = "your_document_id"
        val parameters = JSONObject()
        parameters.put("category", "Meals & Entertainment")
        parameters.put("total", 11.23)
        client.updateDocument(documentId, parameters, { jsonString ->
            //Update UI with jsonString response
            findViewById<TextView>(R.id.response).text = jsonString
        }, { errorMessage ->
            //handle errorMessage
        })
    }
}

Need help?

Visit https://docs.veryfi.com/ to access integration guides and usage notes in the Veryfi API Documentation Portal

If you run into any issue or need help installing or using the library, please contact [email protected].

If you found a bug in this library or would like new features added, then open an issue or pull requests against this repo!

To learn more about Veryfi visit https://www.veryfi.com/

Tutorial

Below is an introduction to the Android SDK.

Link to blog post โ†’

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.