Setup & Authentication
With Amity UIKit 2.3, we have introduced a new way to Authentication process. Just follow the guide below.
Adding required permissions
Your app may require the following permissions to work properly;
Camera access
Microphone access
Photo library usage access
Before submitting your application to the store, please make sure the following permissions are already granted. Here are the steps to ask for permission.
Locate the info.plist
file and add:
NSCameraUsageDescription
NSMicrophoneUsageDescription
NSPhotoLibraryUsageDescription
Setup API key
AmityUIKit
requires an API key. You need a valid API key to begin using the UIKit. Please find your account API key in Amity Social Cloud Console.
After logging in 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.
AmityUIKitManager.setup should only be called once when app starts running. Calling the method repeatedly will create connection problems.
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
Register device
To use any SDK feature, you must first register the current device with a userId
. A device registered with an userId
will be permanently tied to that userId
until you explicitly unregister the device, or until the device has been inactive for more than 90 days. A device registered with a specific userId
will receive all messages belonging to that user.
Additionally, an optional displayName
can be provided if you wish to have this user identified in push notifications.
Register device for push notifications
Registering your app for push notifications will require a device token as a parameter.
Amity's UIKit does not manage:
User-facing requests for push notifications and authorizations
The creation and refreshing of push notification tokens
It's up to your app to take those steps and pass the device token.
Unregister
In the event that your user logs out, you should explicitly unregister the user from the SDK as well, to prevent the current device from receiving any unnecessary or restricted data.
Unregistering a device is a synchronous operation. Once theunregisterDevice
method is called, the SDK disconnects from the server and wipes out user session.
Last updated