Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 44 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,110 +1,124 @@
# CloudSight Android SDK (beta)
# CloudSight Android SDK

Official Android SDK to support:
CloudSight API SDK for Android.

- Recognise Image From File
- Recognise Image From Url
- Set Localization To Recognise Image Response
The CloudSight API SDK for Android includes options for:

At a minimum, this SDK is designed to work with Android SDK 16.
- Recognizing images from a file on device
- Recognizing images from a remote URL
- Setting the localization for an image

## Before you begin
This SDK is designed to work with at least Android SDK 16.

You need your API key and secret (if using OAuth1 authentication). They are available on [CloudSight site](https://cloudsightapi.com/) after you sign up and create a project.
## Table of Contents

* [Getting Started](#getting-started)
* [Installation](#installation)
* [Gradle](#gradle)
* [Usage](#usage)
* [Authentication](#authentication)
* [Sending Images](#sending-images)
* [Example / Demo Application](#example---demo-application)
* [License](#license)

## Getting Started

You will need an `api-key` (and `secret`, if using OAuth1 authentication). You can obtain an `api-key` with a free trial account by [contacting the CloudSight Sales Team](https://cloudsight.ai/contact). We love for developers to try CloudSight, so we encourage you to contact us for a free trial of CloudSight!

## Installation

To use the CloudSight Android SDK, add the compile dependency with the latest version of the CloudSight SDK.
For work you need add `android.permission.INTERNET` and `android.permission.READ_EXTERNAL_STORAGE` permissions in Manifest for your Android project.
You will need to add the `android.permission.INTERNET` and `android.permission.READ_EXTERNAL_STORAGE` permissions in the Manifest of your Android project.

### Gradle


ADD GRADLE DETAILS HERE

## Usage

Create a client instance using simple key-based authentication:
### Authentication
Create a client instance using simple API key-based authentication:

```java
CloudSightClient client = new CloudSightClient().init("your-api-key");
CloudSightClient client = new CloudSightClient().init("api-key");

```

Or, using OAuth1 authentication:
Or, if you using OAuth1 Authentication:

```java
CloudSightClient client = new CloudSightClient().init("your-api-key", "your-api-secret");
CloudSightClient client = new CloudSightClient().init("api-key", "secret");
```

Also, can set localization to responses from CloudSightClient
Also, you may set localization for your responses from `CloudSightClient`:

```java
client.setLocale("en-US");

```

Send the image request using a file:
### Sending Images

Sending an image file from your device:

```java
File file = new File();
client.getImageInformation(file, new CloudSightCallback() {

@Override
public void imageUploaded(CloudSightResponse response) {
Log.d("CloudSight ", "Recognition process startet");

Log.d("CloudSight ", "Recognition started");
}

@Override
public void imageRecognized(CloudSightResponse response) {
Log.d("CloudSight ", "Recognition process finished");
Log.d("CloudSight ", "Recognition finished");
}

@Override
public void imageRecognitionFailed(String reason) {
Log.d("CloudSight ", "Recognition process fail by reason");
Log.d("CloudSight ", "Recognition failed by reason");
}

@Override
public void onFailure(Throwable throwable) {
Log.d("CloudSight ", "Recognition request fail");
Log.d("CloudSight ", "Recognition failed");
}
});
```

Or, you can send the image request using a URL:
Or, you can send the image using a remote URL:

```java
String url = "http://www.example.com/image.png"
client.getImageInformation(url, new CloudSightCallback() {

@Override
public void imageUploaded(CloudSightResponse response) {
Log.d("CloudSight ", "Recognition process startet");

Log.d("CloudSight ", "Recognition started");
}

@Override
public void imageRecognized(CloudSightResponse response) {
Log.d("CloudSight ", "Recognition process finished");
Log.d("CloudSight ", "Recognition finished");
}

@Override
public void imageRecognitionFailed(String reason) {
Log.d("CloudSight ", "Recognition process fail by reason");
Log.d("CloudSight ", "Recognition failed by reason");
}

@Override
public void onFailure(Throwable throwable) {
Log.d("CloudSight ", "Recognition request fail");
Log.d("CloudSight ", "Recognition failed");
}
});
```

## Examples
## Example / Demo Application

There's a working Android example that you can run by opening `app` in Android Studio.
We have included a working Android example of this SDK to demonstrate how it works and can be implemented. You can run this example by opening the `app` directory in Android Studio.

## License

CloudSight Android SDK is released under the MIT license.
The CloudSight Android SDK is released under the MIT license.