Abstract visualisation of Social Media Follow feature

How to implement Follow feature in your Android app

Italo Orihuela
Italo Orihuela
Aug 22, 2023

For social media apps, the ability to follow and unfollow users is a crucial feature. It allows users to stay updated with the activities of others and fosters a sense of community. In this tutorial, we will guide you on how to implement followers feature in your Android application using the Amity Social Cloud SDK. We will cover how to send follow requests, handle follow statuses, and withdraw follow requests. By the end of this tutorial, you will be able to enhance your app’s social interactions by allowing users to connect with each other.


Before we begin, make sure you have the following:

- The Amity SDK installed and set up in your Android project.
- A valid `userId` of the user you want to follow.
- An instance of `AmityUserRepository` to manage user relationships.

Authentication and Log in

Before you can send a follow request, you need to authenticate and log in to your application. Here is how you can run the `AppMain` class in Android:

Next, you need to authenticate the user. Here is how you can do it:

Step 1: Create a Function to Send Follow Request

First, create a function named `sendFollowRequest`. This function will take two parameters: an instance of `AmityUserRepository` and a `userId`, which is the ID of the user you want to follow.

Step 2: Send Follow Request

Inside the `sendFollowRequest` function, use the `follow` method to send a follow request to the user.

Step 3: Handle Success Response

Finally, handle the success response using the `doOnSuccess` method. The `doOnSuccess` method will return an instance of `AmityFollowStatus`, which you can use to determine the status of the follow request.

Full Code Snippet

Here is the complete code snippet for sending a follow request:

Final Thoughts

Implementing the follow feature in your Android application can significantly enhance user interactions and engagement. With the Amity Social Cloud SDK for Android, you can easily integrate follow features and provide a seamless social experience to your users. Remember to handle success responses appropriately to ensure a smooth user experience. Don’t wait any longer, start powering up your community today!