Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
The Amity Social Cloud SDK for JavaScript is delivered as an npm module.
Add the SDK to your repository via npm: npm install @amityco/js-sdk --save
.
Installing the SDK requires you to use a javascript package manager such as
npm
oryarn
. If your current build system does not use package managers, please contact us at community.amity.co.
If you already installed our SDK with the name
eko-sdk
, be sure to check our migration guide from version 4 to 5.
Chrome: 38+
Firefox: 42+
Microsoft Edge: 13+
Safari: 9+
Opera: 25+
Amity Web SDK probably won't work great in Internet Explorer 11. We generally support the recent versions of major browsers listed above.
Since Amity Web SDK uses local cache for performance and user experience reason, server side rendering is not supported. To use Amity Web SDK with NextJS, Amity Web SDK must be imported using Dynamic Import with SSR disabled.
AmitySDK already includes our UIKit. Don’t install the UIKit separately if you have already installed the SDK.
Use our Amity Social Cloud SDK with the Ionic Framework
We now support the Ionic framework in building your application using our web SDK. You can use our Chat natively to support your mobile or web applications built using the Ionic framework.
Since Ionic is an HTML5 framework, it needs a native wrapper to access native SDK functionalities and run as a native app. We recommend using Capacitor.
Capacitor will wrap your application in a native container so you can easily integrate our web SDK to run on iOS, Android, and web platforms.
We will walk you through the process of installing ionic and all the necessary dependencies for development.
Ionic comes with a convenient command line utility to start, build, and package Ionic apps. To install it, simply run:
In the root of your application, install Capacitor:
Now, we need to copy the native platform template into your application:
To open the application in your IDE, run:
For Android, it will open Android Studio. For iOS, it will open Xcode.
Now you’re ready to start integrating our chat SDK into your application.
Ionic with JavaScript framework
platform
The platform template to add (e.g. android
, ios
).
platform
The platform you are using (e.g. android
, ios
).
The Amity Social Cloud SDK for TypeScript is delivered as an npm module.
Add the SDK to your repository with this code:
npm:
yarn:
The very first thing to do once you have installed the SDK, is to creating an instance of the client and logging in.
Once the client has been instantiated and you are logged in. You can now use API's to create a channel, message, community and posts!
Chrome: 38+
Firefox: 42+
Microsoft Edge: 13+
Safari: 9+
Opera: 25+
Amity Web SDK probably won't work great in Internet Explorer 11. We generally support the recent versions of major browsers listed above.
Since Amity Web SDK uses local cache for performance and user experience reasons, server side rendering is not supported. To use Amity Web SDK with NextJS, Amity Web SDK must be imported using Dynamic Import with SSR disabled.
Use our TypeScript SDK natively to support your applications built using the React Native framework.
In order to support older JavaScript runtime, you need to include a global polyfill for your bundled package.
First, install core-js
in your project.
Then, import fromEntries
in the root of your project.
You can check out our React Native sample application here.
The Amity Social Cloud SDK for Android is delivered via Jitpack repository.
Android 5.0 (API level 21) and above*
Target sdk version 29 and above*
Compile SDK Version 29 and above*
JVM target should be 1.8
The API level allows a developer to declare the minimum version with which the app is compatible, using the minSdkVersion
attribute. If your app can't function without these APIs, declare API level 21 and above as the app's minimum supported version. And using targetSdkVersion
29 and above.
Add the Jitpack repository in your project level build.gradle
at the end of repositories:
Add the dependency in your module level build.gradle.
Find latest SDK version at Changelog.
If your minSDKVersion is below 24, ie., 23 or 21, there are additional configurations required.
In your project build.gradle
,
In your app module's build.gradle
, add the following packaging options.
By using our SDK, you can use the Android ProGuard tool to obfuscate, shrink, and optimize your code. Obfuscated code can be more difficult for other people to reverse engineer. ProGuard renames classes, fields, and methods with semantically obscure names and removes unused code. However, you need to add these configurations to your ProGuard rules when using our SDK.
For users who are using the SDK version below 5.33.11
and 6.9.0
. If you'd like to pass an Amity Serializable Object such as AmityPost
, AmityMessage
, etc. You will need to add an additional ProGuard rules below:
For debugging purposes, we provide the ability to show or hide logs from our SDK. In the 'build.gradle' application, you can set the boolean value resValue
"IS HIDDEN AMITY LOG" to true
to hide the logs and to false
to make them visible.
In the 'build.gradle' application, you can also customize the log display depending on the build variant, as in this example.
The Amity Social Cloud SDK for Flutter is available on PubDev
Add the SDK to your repository by adding amity_sdk
depedency
With Flutter:
This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get
) :
Alternatively, your editor might support flutter pub get
. Check the docs for your editor to learn more.
The minimum deployment target is:
iOS: iOS 9.0
Android: Android 4.4 (API Level 19)
This section outlines how you can set-up your ASC project and contains all the tutorial links you'll need to get going .
SDK Installation
For instructions on installing the Amity Social Cloud SDK, refer to the installation guide for your platform.
We are constantly working to improve our existing SDKs. For this reason, the minimum compatibility for our previous versions may vary. Below is the compatibility list for our latest SDKversions. For a complete overview of the compatibility of a specific SDK version, please refer to the corresponding Changelogs.
Xcode Version: 14.3
Realm Version: 10.28.3
Minimum Target: iOS 13.0
OKHTTP3 - 4.9.0
Retrofit - 2.50
Android Paging Data Library - 3.0.1
Room - 2.4.0-alpha04
RxJava2 - 2.3.10
Gson - 2.8.10
Kotlin-std-lib - 1.5.10
HiveMQ mqtt client - 1.2.2
androidx.annotation:annotation: 1.2.0
androidx.core:core-ktx: 1.3.2
androidx.paging:paging-runtime: 3.0.1
androidx.paging:paging-rxjava2: 3.0.1
androidx.lifecycle:lifecycle-livedata: 2.2.0
androidx.lifecycle:lifecycle-reactivestreams:2.1.0-rc01
androidx.multidex:multidex:2.0.1
androidx.room:room-runtime:2.3.0
androidx.room:room-rxjava2:2.3.0
com.f2prateek.rx.preferences2:rx-preferences:2.0.1
com.github.davidmoten:rxjava2-extras:0.1.24
com.google.code.gson:gson: 2.8.7
com.google.guava:guava:30.1.1-android
com.jakewharton.rxrelay2:rxrelay:2.0.0
com.jakewharton.rx2:replaying-share:2.0.1
com.jakewharton.timber:timber:4.7.1
com.squareup.okhttp3:okhttp: 4.9.0
com.squareup.okhttp3:logging-interceptor:3.10.0
com.squareup.retrofit2:retrofit: 2.5.0
com.squareup.retrofit2:adapter-rxjava2: 2.5.0
com.squareup.retrofit2:converter-gson: 2.5.0
io.arrow-kt:arrow-core:0.11.0
io.arrow-kt:arrow-syntax:0.11.0
io.reactivex.rxjava2:rxandroid: 2.1.1
io.reactivex.rxjava2:rxjava: 2.2.19
io.socket:socket.io-client:1.0.0
joda-time:joda-time:2.10.6
org.apache.commons:commons-lang3:3.7
org.jetbrains.kotlin:kotlin-stdlib: 1.5.10
org.jetbrains.kotlin:kotlin-android-extensions-runtime: 1.5.10
org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3
Chrome: 38+
Firefox: 42+
Microsoft Edge: 13+
Safari: 9+
Opera: 25+
Amity JS SDK probably won't work great in Internet Explorer 11. We generally support the recent versions of major browsers listed above.
Since Amity Js SDK uses local cache for performance and user experience reason, server side rendering is not supported. To use Amity Js SDK with NextJS, it must be imported using Dynamic Import with SSR disabled.
Chrome: 38+
Firefox: 42+
Microsoft Edge: 13+
Safari: 9+
Opera: 25+
Amity Ts SDK probably won't work great in Internet Explorer 11. We generally support the recent versions of major browsers listed above.
Since Amity Ts SDK uses local cache for performance and user experience reason, server side rendering is not supported. To use Amity Ts SDK with NextJS, it must be imported using Dynamic Import with SSR disabled.
The minimum deployment target is:
iOS: iOS 9.0
Android: Android 4.4 (API Level 19)
Use our TypeScript SDK natively to support your applications built using the React Native framework.
The instructions for setting up your project will vary slightly, depending on your development environment. Refer this link to set up your project if you have not already done so.
Before you can use the ASC SDK you just installed, we'll first need to create a new SDK instance with your API key. Please find your account API key in the Amity Social Cloud Console or visit our Amity Social Cloud Console page.
After logging into Console:
Click Settings to expand the menu.
Select Security.
In the Security page, you can find the API key in the Keys section.
If you have trouble finding this, you can post in our community forum at community.amity.co so our support team can assist you.
By default, AmityClient
will connect to AmityRegion.SG.
You can specify endpoints manually via AmityEndpoint
struct. API endpoints for each data center are different so you need to adjust the endpoint accordingly.
Note: From Js SDK v5.10.0, we introduced Real time events which requires a new endpoint (mqttEndpoint)
along with the existing apiEndpoint
. So instead of passing multiple parameters for both, we can pass a single apiRegion
parameter. The corresponding endpoints will then be created within the SDK using the passed region. This will be the recommended approach to create a new ASClient for different regions.
We currently support multi-data center capabilities for the following regions:
The SDK does not employ database encryption by default. The database file is solely restricted to the application by the operating system, which is generally sufficient for most use cases. Database encryption serves as an additional layer of security in the event of compromised root access. It's important to note that enabling database encryption may lead to a performance reduction of up to 15% during database read/write operations.
Please note that we only support database encryption for Android SDK 5.35.0 and v6, beginning from version 6.16.0 onwards.
Database Encryption Modes:
The SDK offers three encryption modes:
NONE: No encryption is applied.
AUTH: Access token storage is encrypted.
ALL: All database files are encrypted.
AUTH mode is recommended to introduce extra security with minimal performance compromise. Ultimately, the chosen encryption mode should align with your application's specific requirements.
Encryption key:
Enabling database encryption necessitates an encryption key. It is imperative to consistently pass the same key to the SDK. Should a new key be supplied, the existing database file will be erased and subsequently regenerated, encrypted with the new key.
The level of security offered by encryption hinges on the method of key generation and storage employed by the application. It is strongly recommended to adhere to industry standards for both key storage and generation.
In order to use any ASC SDK feature, you must first log in the current device with a userId
. A logged in device will be tied to the userId
until the device is either proactively logged out, or until the device has been inactive for over 90 days. A logged in device will receive all the events messages belonging to the tied user.
An optional displayName
can be provided, which will be used in standard push notifications (related to user's actions, such as when the new message is sent).
An authToken
is also highly recommended to always be provided, which will be used for a secure authentication. For more info on how to configure secure settings and obtain authToken
, refer to our Security page.
A sessionHandler
is required for SDK to communicate with the app. For more info please refer to Session Handler. Do note that the sessionHandler
is not yet available for Flutter SDK.
It is important to maintain the security of your network and user information. In production environment, we strongly recommend using an authToken for authentication. While the option to not use an authToken may be available, it should only be applied during the development phase and with caution.
The
displayName
is set only on the first time the device is logged in. Please follow your platform's necessary directions if you would like to rename this to something else.
When the user logs out, you should explicitly log out the user from the SDK as well. This prevents the current device from receiving unnecessary and/or restricted data.
Logout is a synchronous operation. Once the logout method is called, the SDK disconnects from the server and wipes out user session.
Logging out is a synchronous operation. Once the logout()
function is called, the SDK disconnects from the server and wipes out user session.
After the SDK is logged in with a user, SDK will maintain the connection as long as it can. However the SDK connection can be terminated due to many reasons, for example:
The device lost Internet connection.
Users close the app into the background, then the operating system pauses the app, and terminates all network connections.
By default the SDK automatically reconnects itself whenever the app has a chance to get back online.
There are some use-cases that developers need more control over the SDK connection. The SDK provides disconnect()
. This method allows developers to explicitly disconnect the SDK while maintaining the current user session so that the app can later resume the connection with the same user.
The functionality isn't currently supported by this SDK.
When developers call disconnect()
:
The SDK will terminate server connections without logging out the current user.
The SDK will not automatically reconnect until the next login.
To resume the connection, the developers should call login(...)
with the current user.
Each user can be logged in, at the same time, to an unlimited number of devices. Amity's Chat SDK will automatically synchronize the user data across all logged in devices. We will also automatically log out any device that has not been connected to the server for more than 90 days.
When a device is logged out due to inactivity, the SDK data on the device will be reset. You will need to re-login this device in order to connect to server again.
Now that you've finished getting your ASC project set up, here are some step-by-step articles if you need a hand building your app!
Check out our Amity Social Cloud UI Kits and Template Apps.
UI Kits Our UI Kits include user interfaces to enable fast integration of standard Amity Chat and Amity Social features into new or existing applications.
Template Apps Our Template Apps are ready-made template applications to kickstart your own Amity Social Cloud project.
With real-life use-cases, we guide you through ways you can get started with building stellar applications for yourself and your clients and their users.
The Amity Social Cloud SDK for iOS is delivered as a binary .xcframework file
Drag AmitySDK.xcframework
, Realm.xcframework
& RealmSwift.xcframework
to your project.
Make sure that Copy items if needed
is selected and click Finish.
Also switch the Embed section as Embed & Sign
The correct setup should look like this.
You need to turn Rosetta mode on when using AmitySDK
with arm64 simulator. To force the application to use Apple Rosetta environment with an Apple silicon Mac, refer to this page for the instructions.
AmitySDK
supports installation via dependency managers.
SwiftPM
Cocoapods
Carthage
To integrate AmitySDK into your project via SwiftPM, please follow the instruction below.
Enter the repository URL to search the package, and choose to install AmitySDK
.
If you selected "Up to Next Major Version
" option for the Dependency Rule, you need to manually add the version.
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate the Amity Social Cloud SDK, add the following line of code to your Cartfile
.
To integrate the Amity Social Cloud SDK into your Xcode project using CocoaPods, specify the following lines of code in your Podfile
:
This installs the latest version of SDK. To get more info about our latest release, please look into changelog section. We support cocoapod installation of our sdk above version 5.1.0. The minimum deployment target platform for iOS is 12.0.
If there are any issues during installation steps, clean cocoapods cache and try again. To clear cache please go to ~/Library/Caches/Cocoapods
and remove `AmitySDK` related folders/files.
If this doesn't work, please do visit the Cocoapods Github repo for further resolutions.
AmitySDK already includes our UIKit. Don’t install the UIKit separately if you have already installed the SDK.
Amity Video requires the AmitySDK
as dependencies. First, ensure you have installed the AmitySDK
as per the instructions above.
To use live video broadcast:
Import AmityLiveVideoBroadcastKit.xcframework
to your project.
To use live video player:
Import AmityVideoPlayerKit.xcframework
to your project
Download MobileVLCKit.xcframework
, and import to your project.
Switch each framework to Embed & Sign
, except MobileVLCKit
to Do Not Embed
.
To install Swift Packages for Amity Video, please follow the instructions below.
Import AmityVideoPlayerKit.xcframework
to your project
Download MobileVLCKit.xcframework
, and import to your project.
Switch each framework to Embed & Sign
, all xcframeworks.
To install Swift Packages for Amity Video, please follow the instructions below.
To use live video broadcast functionalities. Enter the repository URL to search the package, and choose to install AmityVideoBroadcast
.
Try it in your code
To use live video player functionalities. Enter the repository URL to search the package, and choose to install AmityVideoPlayer
.
Try it in your code
If you selected "Up to Next Major Version
" option for the Dependency Rule, you need to manually add the version.
Starting with v6.0.0, AmitySDK for iOS is written in Pure Swift. Although its in pure Swift, you can still use it in Objective-C projects by making Mixed-Language Project.
We recommend you to integrate AmitySDK
for iOS swift directly into your Objective-C project and use Swift language to call the SDK interfaces.
To make a mixed language project, create Swift files with necessary interfaces/methods which in turn interacts with AmitySDK
. These interfaces should be exposed with @objc
or @objcMembers
attributes. Reference: Swift Attributes
When you add new Swift file into your Objective-C project, Xcode automatically generates a bridging header file. This bridging header exposes your Swift code to Objective C code. For more information you can refer to this guide by Apple: Importing Swift into Objective-C
Region
Endpoint
Europe
AmityRegion.EU
Singapore
AmityRegion.SG
United States
AmityRegion.US