Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
The Chat SDK for Android is delivered via maven repository
Add the Jitpack repository in your project level build.grade
at the end of repositories:
Add the dependency in your module level build.grade
:
To get started using the SDK, data binding is required as a mandatory dependency. You need to download the library from the Support Repository in the Android SDK manager. For more information, see Update the IDE and SDK Tools.
To configure your app to use data binding, enable the dataBinding
build option in your build.gradle
file in the app module, as shown in the following example:
Currently, Android does not support Live-Objects as such, we use a protocol that follows ReactiveX for Kotlin and Java related data streams.
You can find out more information here; https://github.com/ReactiveX/RxKotlin
Here's an overview of how you can get started integrating comments into your applications
Each comment is identified by a unique commentId
, which is an immutable string. When creating a new comment, you do not need to specify your own commentId
, and you can leave it to SDK to generate. We also provide optimistic update on each comment. You will need to send a referenceId
which is a contentId
for current supported version. You need to use EkoCommentRepository
before starting any activity with comments, such as editing an operation and/or flagging a comment.
In the future we may support another
referenceType
and will be available in creation method.
There are 2 main methods in EkoCommentRepository
which is creating a comment as well as get a collection of comments. They all return a LiveCollection with the comment model.
Comment management methods are contained in EkoCommentRepository
class. Before being able to call any comment method, you must initialise a repository instance using the EkoClient
instance ,which you created on setup:
EkoCommentRepository
provides createComment()
method to create comment. You can provide referenceId
, parentId
and text
while creating a comment. parentId
is an optional parameter, useful for replying a comment. The concept is similar to the EkoMessage
where you can reply a message object with a parentId
. For now, only text
data is supported in the creation method.
EkoCommentRepository
provides getCommentCollection()
method to query for comments. The query returns a LiveCollection of all the matching comments available.
To query for replies to a specific comment. You can pass the commentId as the parentIdparentId = commentId
. To get parent level, pass parentId = null
. Omitting parentId
will get all comments on all levels.
Currently EkoComment
has one data type TEXT
. Other types are coming soon.
Comment editing options depend on EkoComment
data type.
On EkoComment.Data.Text
model, there is an edit()
method that initiates text data editing chain. The replacing text can be passed to text()
method.
To delete a comment, the delete()
method is available on the EkoComment
model.
On EkoCommentFlagger
modelflag()
and unflag
methods are available.
The info such as flagCount: Int
and isFlaggedByMe: Boolean
are also available in the EkoComment
model via getFlagCount()
and isFlaggedByMe()
methods respectively.
EkoComment
provides react()
method to help instantiate EkoReactor
model.
In EkoReactor
modeladdReaction()
and removeReaction()
methods are available.
EkoComment
model provides info such as the reactions reactionCount: Int
,myReactions: List<String>
, reactionMap: EkoReactionMap
via getReactionCount()
, getMyReactions()
, and getReactionMap()
methods respectively.
With this solution the notifications will be triggered and delivered to your users directly by Amity's servers. There's nothing that the Android client has to do in order to display the notification to your users. Amity's servers will prepare for you a notification that can be directly displayed to the user as and when it's received.
In order for Amity's server to start sending push notification to the Android client , You need to prepare the Firebase certification (for the device that support by google push notification service) Or Baidu cloud Push certification(for the device not support by google service) and uploaded to Amity system via Amity Admin panel.
A new push notification will be sent to a specific user when the following event happens IN a community user a member.
A new post has been created in the community user is a member.
Post owner has been reacted by a user in the community
Post owner has new Comment created by a user in the community.
Comment or Reply owner has been reacted by a user in the community
Comment owner has a new Reply created by a user in the community.
As Amity's servers are responsible for choosing the content of the push notification, you can expect your users to receive the following notifications for different kind of events:
A new post has been created in the community user is a member.
Title : CommunityDisplayname
Body : userDisplayname
created new post in your community.
Post owner has been reacted by a user in the community
Title : CommunityDisplayname
Body : userDisplayname
reacted to your post
Post owner has new Comment created by a user in the community.
Title : CommunityDisplayname
Body : userDisplayname
commented to your post
Comment or Reply owner has been reacted by a user in the community
Title : CommunityDisplayname
Body : userDisplayname
reacted to your comment
Comment owner has a new Reply created by a user in the community.
Title : CommunityDisplayname
Body : userDisplayname
replied to your comment
as default, all the event related to the Community feature has default context base on each event trigger, to customize the context for each event, you can access to Admin panel to do so.
The SDK has three levels of notifications and in order for it to be sent, a notification has to pass throughout all three levels.
Network Level: (via Admin Panel) turning off notifications at this level effectively disable push notifications altogether for all of your customers.
User Level: (via client) A user can choose to enable/disable the notifications that it receives on the device (this is an absolute option: enable all or disable all). Please note that this setting is per user, not per device: regardless of which device sets this toggle, the new preference will take effect in all the devices where the user is logged in.
Community Level: (via client) A user can choose to enable/disable notifications for a specific community (where is member of). Again, this preference is per user, not per device.
please note that if the Network level has been disable , the event in the User level AND Community level will be disabled as well.
The first step of receiving the Push notification is start with the following step
FCM dependency:
Before you can start receiving push notifications, you need to obtain a FCM unique token string that identifies each FCM client app instance:
You can initialize the services with the obtained token. Please note that the FCM token can be changed through application life cycle. Please make sure that the FCM token supplied to the messaging SDK is up to date. To notify the messaging SDK of the latest token, the following line of code can be called whenever necessary:
Since Google play services are banned in China, The messaging SDK provides Baidu push services as a substitute for FCM. The messaging SDK requires an api key and a secret key from Baidu:
Baidu dependency:
Note: Baidu push services require number of additional permissions. You can find a list of permissions here.
Baidu API key is needed for Baidu push services initialization:
Note: The messaging SDK always consider FCM as a primary push provider and Baidu as a secondary push provider. If the messaging SDK detects Google play services on the device, Baidu push services won't be initialized.
The registration will automatically pick up the active userId
, and Amity's back-end will start sending push notifications to the particular user. In the where the active userId
has been changed, registration will be required again.
Registering your app for push notification will require a registered EkoClient
instance (necessary to know which user is associated with this device) and a push notification token.
Amity's Development Kit 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 notification token to the SDK.
We recommend to observe the completion block outcome to assure of a successful registration.
If the device was previously registered with this or another user, the previous registration is invalidated as soon as this new request is received, which means that the device will always receive notifications of up to one user.
For community preferences we use the EkoCommunityRepository
, obtained via instance of EkoCommunityRepository
:
For user preferences we use the EkoClient
, obtained via instance of EkoClient
:
Unlike the registration, unregistering for push does not require the EkoClient
instance to be associated with any user, therefore you can unregister the device from receiving push notifications as soon as the EkoClient
has been initial
Plug in this module to enable social features such as Feeds, Groups, Profiles, Content Posts, and Social Media Type Interactions
Foster a sense of belonging among your community and make your app a safe place for your users to connect and interact with others.
Here's an overview of how you can get started integrating comments into your applications
When creating a new community, first instantiates the EkoCommunityRepository
, a class that contain all community related methods. Then call createCommunity()
to obtain the RxJava and observe it in order to obtain the final community model.
If you prefer create community with an avatar you can first upload image with EkoFileRepository
then pass the obtained EkoImage
to createCommunity
API.
The joinCommunity()
method will add the active user as a member of the channel.
This API can be called as many time as needed. If the community has already been joined, a "success" result will be returned, ie., going into doOnComplete{}
block.
In the case where you only want to fetch a community data without joining, you can use the getCommunity(:id)
method:
There are methods to obtain communities that only match specific criteria:
the withKeyword
parameter let you filter communities based on the community displayName
the sortBy
parameters let you filter communities based on the order that the communities were created or based on alphabetical order
the filter
parameter let you filter communities based on the logged in user membership status
the categoryId
parameters let you filter communities based on community categories
If you want to update a community, you can call the following:
Note. By default, only the community's original creator or administrators can update the community.
You can get a list of community members by calling the following method:
Note. By default of sortBy is LAST_CREATED so you can skip .sortBy in builder
also you can query community membership with userId by use getCommunityMembership(:userId)
via EkoCommunityParticipation
.
Creator of community can add and remove role of user via EkoCommunityModeration
.
The EkoCommunityParticipation
provides a list of members by role in the given community.
You can check your permission in community by sending EkoPermission
enums to EkoClient.hasPermission(:ekoPermission)
method.
The EkoCommunityRepository
will also be able to manage community categories. When communities are put into a category, you will be able to sort and filter each of the communities in that category.
Note. Right now categories will only be creatable and updatable from the Amity Social Cloud Console.
This method provides the ability to obtain all the categories.
Note. By default of sortBy is NAME so you can skip .sortBy in builder
Before using the Social SDK, you will need to create a new SDK instance with your API key. Please find your account API key via the Admin Panel. If you have trouble finding this, you can send our support team an email at developer@amity.co
In order to use any Social SDK feature, you must first register the current device with an userId
. A registered device will be tied to the registered userId
until the device is either proactively unregistered, or until the device has been inactive for over 90 days. A registered 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).
When the user logs out, you should explicitly unregister the user from the SDK as well. This prevents the current device from receiving unnecessary and/or restricted data.
Each user can be registered, at the same time, to an unlimited number of devices. Amity's Social SDK will automatically synchronize the user data across all registered devices. We will also automatically unregister any device that has not been connected to the server for more than 90 days.
When a device is unregistered due to inactivity, the SDK data on the device will be reset. You will need to re-register this device in order to connect to server again.
If you have any logic or UI around the connection status, you can observe the connectionStatus
property on the EkoClient
instance.
Since the SDK automatically manages the network connection and queue up any requests in cases of bad connection, there should be little need to attach additional logic to this status. However the user may want to know the exact network status to determine if their actions will be performed in real-time, therefore this status is exposed.
Our Sample app adopts an open source framework that highlights how Amity Social Cloud SDK's can be implemented into application builds pragmatically.
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
Download the Android sample app
A feed is made up of a collection of posts. Users will be able to generate different types of posts as well as to react and comment on posts.
When you want to parse EkoImage object you can upload image uri or id by using EkoClient.newFileRepository()
the following:
When you want to parse EkoFile object you can upload file uri or id by using EkoClient.newFileRepository()
the following:
When creating a text post, call the following method:
Note. A post can consist of either a list of images or a list of files but not both.
You can use the getPost(:postId)
method in order to get a single post:
Note. Only the post owner or an admin will be able to delete a post.
If you prefer to update post. You have to use EkoPost that you received for update post and check data type in the following:
You can add a reaction to a post by using EkoPost that you received and call the following method:
You can remove a reaction of a post by using EkoPost that you received and call the following method:
You can use EkoPost that you received to add a comment to a post by using our Comment feature:
You can use EkoPost that you received for reply a comment to a post by using our Comment feature:
You can use EkoPost that you received for flag a post as inappropriate by using the following method:
You can use EkoPost that you received to get status flag the following:
You can use EkoPost that you received for unflag a post the following method:
This page contains an overview of all relevant changes made to the Amity Social SDK modules and the latest version releases
Eko Messaging SDK 4.8.0 is released.
Add push notification functionality to EkoCommunityRepository
Refer to Push notifications documentation.
None
Set turn on and off push notification as user level by .setAllowed(allowed: Boolean)
Get push notification setting values as user level by .isAllowed(): Single<Boolean>
None
None
OKHTTP - 3.10.0
Retrofit - 2.4.0
Kotlin-std-lib - 1.3.72
Eko Messaging SDK 4.7.1 is released.
None
None
None
Optimize PagedList configuration
Fix incorrect pagination of categories
None
OKHTTP - 3.10.0
Retrofit - 2.4.0
Kotlin-std-lib - 1.3.72
Eko Messaging SDK 4.7.0 is released.
Introduce eko-video-publisher
for video broadcasting. Refer to Video documentation.
Add manual paging functionality to EkoCommentQuery
Refer to Comment documentation.
None
None
None
None
OKHTTP - 3.10.0
Retrofit - 2.4.0
Kotlin-std-lib - 1.3.72
Eko Messaging SDK 4.6.0 is released.
Add new option .roles(roles: List<String>)
inEkoChannelMembershipQuery.Builder
. Refer to Channel
documentation.
Add new option .sortBy(option: EkoCommentSortOption)
in EkoCommentQuery.Builder
. Refer to Comment
documentation.
Add new API getLatestComment()
in EkoCommentRepository
. Refer to Comment
documentation.
Add custom dataType
support for EkoPost
. Refer to Feed
documentation.
Change query option setIsLive(isLive: Boolean)
to setStatus(statuses: Array)
in EkoStreamQuery.Builder
. The user is now able to query live-stream videos based on its statues.
Query memberships by role. .role(role: String)
ImprovegetMyReactions()
performance on EkoMessage
, EkoPost
, EkoComment
None
OKHTTP - 3.10.0
Retrofit - 2.4.0
Kotlin-std-lib - 1.3.72
Eko Messaging SDK 4.5.1 is released.
None
None
None
Active user missing from community list when community has more than 10 members
None
OKHTTP - 3.10.0
Retrofit - 2.4.0
Kotlin-std-lib - 1.3.72
Eko Messaging SDK 4.5.0 is released.
Add query option setIsLive(boolean)
in EkoStreamQuery.Builder
. The user is now able to query currently live or ended live-stream videos.
Add new method getRecordings()
in EkoStream
model . The user is now able to get recorded videos.
None
None
None
None
OKHTTP - 3.10.0
Retrofit - 2.4.0
Kotlin-std-lib - 1.3.72
Eko Messaging SDK 4.4.2 is released.
Comment in FAILED
state can be hard deleted by deleteComment(commentId)
API
Post deletion by deletePost(postId)
API results in hard deletion of the post from Global feed ranking
Fixed incorrect behaviour of private community query.
Eko Messaging SDK 4.4.1 is released.
Comment isDeleted
property to be updated after initial query.
Eko Messaging SDK 4.4.0 is released.
Aligning file related message data return type with Feed
feature,
Replacing getUrl() : String
with getImage() : EkoImage
inEkoMessage.Data.IMAGE
Replacing getUrl() : String
with getFile() : EkoFile
inEkoMessage.Data.FILE
Eko Messaging SDK 4.2.0 is released.
Add Feed
feature. Refer to Feed
documentation.
Eko Messaging SDK 4.0.0 is released.
Add Comment
on content
feature
Revise all existing APIs . See each feature documentation for more info.
Let users react to messages, posts, and comments, which are visible to others.
This functionality is not currently supported for Android but will be coming soon! We will update the relevant sections accordingly
Let users react to messages, posts, and comments, which are visible to others.
This functionality is not currently supported for Android but will be coming soon! We will update the relevant sections accordingly
All the errors returned by the SDK come in form of an EkoException
. The possible error codes are listed in a public EkoError
enum: each case is named after its error and they are designed to be self explanatory.
You can convert an EkoException
into EkoError
enum with the following:
When an error is returned as a result of an action from your side (e.g. trying to join a channel), the action can considered complete, and the SDK will not execute any additional logic.
The EkoClient
class includes the EkoClient.errors()
method that can be called and observed to asynchronous errors. This observable object notifies you of errors that can potentially break the functionality of the SDK. The SDK logic is usually robust enough to automatically handle most errors, as such, only unrecoverable errors are exposed through this observable (for example, if the login session was invalidated).
We recommend you to always handle these errors in a production app by gracefully disabling messaging functionality in the event of an error.
Error
Code
BAD_REQUEST_ERROR
400000
INVALID_REGULAR_EXPRESSION
400001
UNAUTHORIZED_ERROR
400100
FORBIDDEN_ERROR
400300
PERMISSION_DENIED
400301
USER_IS_MUTED
400302
CHANNEL_IS_MUTED
400303
USER_IS_BANNED
400304
NUMBER_OF_MEMBER_EXCEED
400305
EXEMPT_FROM_BAN
400306
MAX_REPETITION_EXCEED
400307
BAN_WORD_FOUND
400308
LINK_NOT_ALLOWED
400309
TOO_MANY_MEMBER_ERROR
400310
RPC_RATE_LIMIT_ERROR
400311
USER_IS_GLOBAL_BANNED
400312
ITEM_NOT_FOUND
400400
CONFLICT
400900
BUSINESS_ERROR
500000
Error
Code
UNKNOWN
800000
INVALID_PARAMETER
800110
MALFORMED_DATA
800130
FILE_SIZE_EXCEEDED
800140
CONNECTION_ERROR
800210