Getting started
Learn how to add the OpenWeb SDK to your Android app.
The Android SDK enables you to create a fluent conversation experience in your Android app that fuels quality interactions with community and content and allows users to create valuable and engaging content. Benefits of the Android SDK include the following:
- SSO support
- Customizable Conversation appearance
- Realtime moderation
- Ability to continue a conversation started on your web pages
Requirements
- Android 6.0 (API level 23) or later
- OpenWeb account
- Android Studio
Add and initialize the Android SDK
To add a Conversation to your app, you must import the OpenWeb Android SDK and then configure your project.
Use the following steps to import the SDK from Maven:
- From within Android Studio, open your app.
- In the project build.gradle file, add Maven Central.
allprojects {
repositories {
...
mavenCentral()
}
}
- In the app build.gradle file, add the dependency below.
dependencies {
...
implementation 'io.github.spotim:spotim-sdk:<<AndroidVersion>>'
}
-
In the AndroidManifest.xml file, add the permissions to use the Internet and to enable users to add images to comments from a camera or photo library.
<uses-feature android:name="android.hardware.camera" android:required="false" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.CAMERA"/> <application> ... </application>
-
In
onCreate()
of the application class, initialize the OpenWeb SDK with your Spot ID. You can also initialize the OpenWeb SDK with a callback. The callback indicates if the initialization has been successful.
SpotIm.init(
this,
"SPOT_ID"
)
SpotIm.init(
this,
"SPOT_ID",
object: SpotVoidCallback {
override fun onSuccess(fragment: Fragment) {
// All good...
}
override fun onFailure(exception: SpotException) {
when(exception) {
is SPServerErrorException -> { } // do something
is SPNoInternetConnectionException -> { } // do something
is SPSdkDisabeledException -> { } // do something
else -> { } // do something
}
}
}
)
Updated 5 months ago