An android detection library that uses Azure Computer Vision Read API to detect MPESA business and/or account numbers from images
# MPESA-Biz-No-Detector
An android detection library that uses Azure Computer Vision Read API to detect MPESA business and/or account numbers from images
## Demos
Start Vision Activity | Pass a Bitmap
------------ | -------------
|
## Prerequisite
- Understanding of Microsoft Azure Cloud Service
- An Azure subscription - Create one for free
- Once you have your Azure subscription, create a `Computer Vision resource` in the Azure portal to get your `key` and `endpoint`. After it deploys, click Go to resource.
You will need the `key` and `endpoint` from the resource you created to connect your application to the Computer Vision service. You can use the free pricing tier (F0) to try the service, and upgrade later to a paid tier for production.
## Installation
Current Version:
#### Gradle
Add the following
```
allprojects {
repositories {
...
maven { url '
jitpack.io' }
}
}
```
```
dependencies {
implementation 'com.github.jama5262:MPESA-Biz-No-Detector:1.0.0'
}
```
#### Maven
```
jitpack.io
jitpack.io
```
```
com.github.jama5262
MPESA-Biz-No-Detector
1.0.0
```
Great the project has been setup 👍
## Usage
There are a two ways you can use the library. Either:-
1. Start a vision activity
2. Pass your own bitmap image
### Start vision activity
Add Permissions to Manifest
```xml
```
Initialize `MPESABizNoDetector` by passing your Azure Vision credentials
```kotlin
const val CAMERA_REQUEST_CODE = 1
private val mpesaBizNoDetector = MPESABizNoDetector(
"YOUR_AZURE_VISION_ENDPOINT",
"YOUR_AZURE_VISION_KEY"
)
```
Start `MPESABizNoDetectorActivity` using the following code
```kotlin
//Make sure you have requested the user for CAMERA permission before continuing
private fun startVisionActivity() {
mpesaBizNoDetector.startActivity(this@YourActivityClass, CAMERA_REQUEST_CODE)
}
// You can also start the `MPESABizNoDetectorActivity` from a Fragment. See below
private fun startVisionActivity() {
mpesaBizNoDetector.startActivity(this@Y …