Installation
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: 13.4
Realm Version: 10.21.1
Minimum Target: iOS 12.0
Initialization
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.
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.
Specify Endpoints Manually (Optional)
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.
We currently support multi-data center capabilities for the following regions:
Region | Endpoint |
Europe | AmityRegion.EU |
Singapore | AmityRegion.SG |
United States | AmityRegion.US |
Authentication
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
can also be provided, which will be used for authentication. Should you choose to use insecure settings on your network, this parameter can be ignored. 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.
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.
Logout
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.
Disconnect
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.
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.
Devices
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.
Tutorials
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!
Amity Social Cloud Developer Kits
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.
Last updated