Channel Member Data

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.

// 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();

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.

// 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) {
			
	}
    });

Last updated