Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/veryfi/veryfi-android

Android kotlin module for communicating with the Veryfi OCR API
https://github.com/veryfi/veryfi-android

android android-library invoice mobile ocr receipt sdk veryfi veryfi-api

Last synced: 3 months ago
JSON representation

Android kotlin module for communicating with the Veryfi OCR API

Awesome Lists containing this project

README

        


[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![code coverage](./metrics/code_coverage.svg)](./metrics/code_coverage.svg)

**veryfi** is a Android module for communicating with the [Veryfi OCR API](https://veryfi.com/api/)

## Installation

Install from [Maven](https://mvnrepository.com/), a
package manager for Java.

Add in your project build.gradle file the veryfi android SDK dependency:
```ruby
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/](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

```

Process a document
```java
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(R.id.response).text = jsonString
}, { errorMessage ->
//handle errorMessage
})
}
}
```

Update a document
```java
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(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 →](https://www.veryfi.com/android/)