Member Specific Data
You can set member specific information.
You can store data in memberInfo and privateData fields in the form of a map.
privateTag field can be used as a search filter when retrieving list of channels.
privateData is only visible to the current user while memberInfo is publicly visible to anyone.
You can enter up to 5 key-value pairs in memberInfo and privateData fields. The maximum size of key is 128 characters and the maximum size of value is 1024 characters. Both key and value must be strings.
Java Kotlin
Copy // update channel member info
TalkPlus . updateChannelMemberInfo (tpChannel ,
data ,
new TalkPlus . CallbackListener < TPMember >() {
@ Override
public void onSuccess ( TPMember tpMember) {
// get memberInfo
// tpMember.getMemberInfo();
}
@ Override
public void onFailure ( int errorCode , Exception exception) {
}
}
);
// update private data
TalkPlus . updateChannelPrivateData (tpChannel ,
data ,
new TalkPlus . CallbackListener < TPChannel >() {
@ Override
public void onSuccess ( TPChannel tpChannel) {
}
@ Override
public void onFailure ( int errorCode , Exception exception) {
}
}
);
// get private data
tpChannel . getPrivateData ();
// update private tag
TalkPlus . updateChannelPrivateTag (tpChannel ,
privateTag ,
new TalkPlus . CallbackListener < TPChannel >() {
@ Override
public void onSuccess ( TPChannel tpChannel) {
}
@ Override
public void onFailure ( int errorCode , Exception exception) {
}
}
);
// get private tag
tpChannel . getPrivateTag ();
Copy // update channel member info
TalkPlus. updateChannelMemberInfo (tpChannel,
data ,
object : TalkPlus . CallbackListener < TPMember >() {
override fun onSuccess (tpMember: TPMember ) {
// get memberInfo
// tpMember.getMemberInfo();
}
override fun onFailure (errorCode: Int , exception: Exception ) { }
})
// update private data
TalkPlus. updateChannelPrivateData (tpChannel,
data ,
object : TalkPlus . CallbackListener < TPChannel >() {
override fun onSuccess (tpChannel: TPChannel ) { }
override fun onFailure (errorCode: Int , exception: Exception ) { }
})
// get private data
tpChannel.privateData
// update private tag
TalkPlus. updateChannelPrivateTag (tpChannel,
privateTag,
object : TalkPlus . CallbackListener < TPChannel >() {
override fun onSuccess (tpChannel: TPChannel ) { }
override fun onFailure (errorCode: Int , exception: Exception ) { }
})
// get private tag
tpChannel.privateTag
Channel Private Tag
You can put a private tag on channel to help with channel search.
privateTag is visible only to current user and is used for filtering channels (ex. "my_favorite_channels")
TPChannelQueryParams class is available starting from TalkPlus Android SDK v0.5.6.
Java Kotlin
Copy // put a private tag on channel
TalkPlus . updateChannelPrivateTag (tpChannel ,
privateTag ,
new TalkPlus . CallbackListener < TPChannel >() {
@ Override
public void onSuccess ( TPChannel tpChannel) {
}
@ Override
public void onFailure ( int errorCode , Exception exception) {
}
}
);
// get channels that match the private tag
TPChannelQueryParams tpChannelQueryParams =
new TPChannelQueryParams . Builder ()
. setLastChannel (lastChannel)
. setChannelName (channelName)
. setPrivateTag (privateTag)
. setSubCategory (subCategory)
. setMemberIds (memberIds)
. setCategory (category)
. setFrozenType ( TPChannelQueryParams . TPChannelFrozenType . NONE )
. build ();
TalkPlus . searchChannels (tpChannelQueryParams , new TalkPlus . TPCallbackListener < List < TPChannel > , Boolean >() {
@ Override
public void onSuccess ( List < TPChannel > tpChannels , Boolean hasNext) {
}
@ Override
public void onFailure ( int errorCode , Exception exception) {
}
});
Copy // put a private tag on channel
TalkPlus. updateChannelPrivateTag (tpChannel,
privateTag,
object : TalkPlus . CallbackListener < TPChannel >() {
override fun onSuccess (tpChannel: TPChannel ) { }
override fun onFailure (errorCode: Int , exception: Exception ) { }
})
// get channels that match the private tag
val tpChannelQueryParams: TPChannelQueryParams =
TPChannelQueryParams. Builder ()
. setLastChannel (lastChannel)
. setChannelName (channelName)
. setPrivateTag (privateTag)
. setSubCategory (subCategory)
. setMemberIds (memberIds)
. setCategory (category)
. setFrozenType (TPChannelQueryParams.TPChannelFrozenType.NONE)
. build ()
TalkPlus. searchChannels (tpChannelQueryParams, object : TalkPlus . TPCallbackListener < List < TPChannel >, Boolean >() {
override fun onSuccess (tpChannels: List < TPChannel >, hasNext: Boolean ) { }
override fun onFailure (errorCode: Int , exception: Exception ) { }
})
Last updated 5 months ago