Getting Started
This guide will help you to get started with the SDK. The SDK is a set of tools that allows you to interact with the API.
Pre-requisite
- Firebase Project(Used for account management) - Create a Firebase project in the Firebase console if you don’t already have one. You can do this by visiting the Firebase Console.
- Register your project on firebase.
Integrating the SDK
- Download the
google-services.jsonfile from the firebase console and place it in the<project>/<app-module>directory of your project. - Add the plugin to your
<project>/build.gradle.ktsfile.
plugins {
alias("com.google.gms.google-services") version "4.4.2" apply false
}
- Add the plugin to your
<project>/<app-module>/build.gradle.ktsfile.
plugins {
alias("com.google.gms.google-services")
}
- Add the following dependency to your
<project>/<app-module>/build.gradlefile.
dependencies {
implementation("ai.instavision:guardian:<version>") // version can be found in the change log.
}
Initializing the SDK
- Create an Application file and initialize the SDK and firebase.
class SampleApp : Application() {
override fun onCreate() {
super.onCreate()
FirebaseApp.initializeApp(this)
InstaVision.initialize(
applicationContext = this,
partnerId = "Your-Partner-Id",
clientId = "Your-Client-Id",
deviceId = "Your-Device-Id",
sessionId = "Your-Session-Id",
region = ServerRegions.US,
environment = Environment.STAGING
)
}
}
- Add the following code to your
<project>/<app-module>/AndroidManifest.xmlfile.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<application android:name=".SampleApp" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:theme="@android:Theme.Material.Light.NoActionBar">
<activity android:name=".MainActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>