ClickCease
Social media post in Android apps

Beginner’s guide to creating Custom Posts on Android

Italo Orihuela
Italo Orihuela
Engineer
Android
Oct 10, 2023

Nowadays, online social environments require continuous follow-up in order to understand the best use case that encourages engagement. Hence, customization is key to standing out and giving your audience an attractive proposal. This tutorial will guide you through the process of creating your own custom post types on Android using the Amity Social Cloud SDK for Android.

We will focus on the specifics of defining your own data types, customizing JSON objects, attaching files, and adding tags to your posts. This will allow you to present unique content to your users, enhancing their experience and engagement. So, get ready to break the monotony and add a personal touch to your app posts.

Pre-requisites

Before we dive into the tutorial, ensure you have the following requirements:

  1. Amity Social Cloud SDK installed in your Android project
  2. Access to the Amity Social Cloud Console
  3. An app instance integrated with your platform (Could use our UI Kits as a sample project)

Note: If you haven’t already registered for an Amity account, we recommend following our comprehensive step-by-step guide on how to create your new network.

Step 1: Understanding Custom Post Types

Custom post types allow you to display content that cannot be represented by the available text, image, video, and file post types. They include additional metadata and custom data formatting, allowing you to present specific types of content to your users.

Step 2: Defining Your Data Type

The dataType is a string that defines the type of the post. This helps distinguish your new post from others. The dataType parameter should have the custom prefix. For example, you can define your custom dataType as "amity.custom". Remember, the custom dataType must be in this pattern ".".

Step 3: Customizing Your JSON Object

The data is a free-form JSON object that can be customized based on your use cases. This is where you can include the specific details of your custom post. For instance, you can include a user ID and a birthday message if you're creating a birthday post.

Step 4: Attaching Files

The attachments parameter allows you to include images and other files in your post. However, you can only attach one file type. This means that it must either be all images, all files, or all video files.

Step 5: Adding Tags

The tags parameter allows you to add text that will be used in post query. You can add up to five tags, and each tag can have a maximum length of 24 characters. This is useful for categorizing your posts and making them easily searchable.

Step 6: Creating the Custom Post

Now that we have defined our custom post parameters, we can create the custom post. You can do this by querying the user, community, or global feed using the Amity SDK’s APIs. Here’s a sample code snippet on how to create a custom post on a user feed:

Final Thoughts

Creating custom post types on Android using the Amity Social Cloud SDK is a powerful way to enhance user engagement and provide unique content. It allows you to break away from the standard post types and add a personal touch to your app. Remember, the key to successful customization is understanding your users’ needs and providing content that meets those needs.