# Installation Guide

### OkayCam&#x20;

{% tabs %}
{% tab title="Android" %}

### Android Installation Guide

*<mark style="color:blue;">Note: Please make sure the SDK version tally with the provided license key.</mark>*&#x20;

OkayCam SDK is available through maven central repo. To install it, add following dependency in `app/build.gradle` dependencies block:

```
dependencies {
    implementation('com.innov8tif.okaycam:OkayCam:3.0.0') {
        transitive = true
    }
}   
```

Also add following repo in project root `build.gradle`:

```
allprojects {
    repositories {
        maven {
            url "https://innov8tif-okaycam.firebaseapp.com"
            content {
                includeGroup "com.innov8tif.xendity"
            }
        }
    }
}
```

#### License Key

The license key is a `string` which you need to request from Innov8tif. In the following usage example, we put as `LICENSE_KEY` but you can use whatever variable name you want.

#### Starting Camera

* Camera can be launched by invoking **start** method on OkayCamDoc with context,config and callback method as follow
* config object is optional if you call from Kotlin (refer to Configuration for more info)
* after the image is captured or the user cancel, the callback method will be called (refer result)

```
OkayCamDoc.start(this,LICENSE_KEY, config) { success, images, exception ->
    // do something with the result
}
```

{% endtab %}

{% tab title="iOS" %}

### iOS Installation Guide

In iOS, OkayCam is available through the [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html). The first step of the installation for OkayCam in iOS is to simply add the following line of code to your Podfiles as shown below:

*<mark style="color:blue;">Note: Please make sure the SDK version tally with the provided license key.</mark>*&#x20;

```swift
  use_frameworks!
  pod 'OkayCam'

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == "CryptoSwift"
        puts "Enable module stability for CryptoSwift"
        target.build_configurations.each do |config|
            config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
        end
      end
    end
```

After adding the code above to the Podfiles:

* Run the command `pod install` to install the dependency
* Add `NSCameraUsageDescription` to the `info.plist` in order to gain camera permissions

{% hint style="info" %}
For iOS versions, we are actively published to Cocoapods. User can keep track of the version using the [site](https://cocoapods.org/). However, in the site, user will need to type in "OkayCam" in the search bar to view the latest version.
{% endhint %}
{% endtab %}

{% tab title="React-Native" %}

### React-Native Installation Guide

In React-native, the first step of the installation is to install the react-native OkayCam into the environment using the command below:

*<mark style="color:blue;">Note: Please make sure the SDK version tally with the provided license key.</mark>*&#x20;

*<mark style="color:orange;">**Version 3:**</mark>*

<pre><code><strong>$ yarn add react-native-okaycam@3.x.x   - For version 3 
</strong></code></pre>

*<mark style="color:orange;">**Version 1:**</mark>*

<pre><code><a data-footnote-ref href="#user-content-fn-1">$</a> react-native install react-native-okaycam@1.1.28
</code></pre>

#### For Android in React-Native:

1. Navigate to `android` folder
2. Add following snippet in the root `build.gradle` file:

```
allprojects {
    repositories {
        maven {
            url "https://innov8tif-okaycam.firebaseapp.com"
            content {
                includeGroup "com.innov8tif.xendity"
            }
        }
    }
}
```

3. Sync Gradle

#### For iOS in React-native:

1. Navigate to iOS folder
2. Add the following code to Podfile

```
platform :ios, '15.0'
use_frameworks!

post_install do |installer|
    installer.pods_project.targets.each do |target|
    	if target.name == "CryptoSwift"
        	puts "Enable module stability for CryptoSwift"
        	target.build_configurations.each do |config|
            	config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
        	end
      	end
      	if (target.name&.eql?('FBReactNativeSpec'))
        	target.build_phases.each do |build_phase|
          		if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
        	    	target.build_phases.move(build_phase, 0)
          		end
        	end
      	end
      	target.build_configurations.each do |config|
        	config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
        	config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
      	end
    end
end
```

After adding the code above to the Podfiles:

* Run the command `pod install` to install the dependency
* Add "NSCameraUsageDescription" to the info.plist in order to gain camera permissions

{% hint style="info" %}
For React-Native versions, we are actively published to npm. User can keep track of the version using the [site](https://www.npmjs.com/package/react-native-okaycam).
{% endhint %}

## Issues

#### Android:

1. There will be a duplicate class "org.hamcrest.xxx"

If the above error is encountered, it can be solved by excluding the "**junit**" module below:

```
configurations { compile.exclude group: "junit", module: "junit" }
```

#### iOS:

1. There will be several issues stated in the quote below:

> Undefined symbol: \_*swift\_FORCE\_LOAD*$\_swiftUniformTypeIdentifiers
>
> Undefined symbol: \_*swift\_FORCE\_LOAD*$\_swiftCoreMIDI

If users encountered the errors above, it can be solved by creating a new swift file called **Void.swift** without adding a **bridging header**.

![](https://1723857616-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoP1M8bTYgFFHHnAdjjta%2Fuploads%2FfhLSLJKGzf6Hz1DoXQ6h%2Fvoid9.jpg?alt=media\&token=8a4b278c-61f6-4b6f-849e-aaef160a2b67)

## License

After that, a license key is required for both Android and iOS by adding the code below:

```
const license = Platform.select({
    android: "",
    ios: ""
})
```

{% endtab %}

{% tab title="Flutter" %}
Please refer to

OkayCam SDK V1

{% embed url="<https://gitlab.com/innov8tif-public/flutter/okaycam-flutter-demo>" %}

OkayCam SDK V2

{% embed url="<https://gitlab.com/innov8tif-public/flutter/okaycam-flutter-demo/-/tree/main-v2>" %}

OkayCam SDK V3

<https://gitlab.com/innov8tif-public/flutter/okaycam-flutter-demo/-/tree/main-v3?ref_type=heads>
{% endtab %}
{% endtabs %}

{% hint style="info" %}
Please be aware of the codes and commands above are **case sensitive.**
{% endhint %}

[^1]:
