How to implement a friend circle function in the app a brief analysis of the principle of the realization of the circle of friends--arrow Buckle technology Arrownock

Source: Internet
Author: User

How to implement a friend circle function in the app analysis of the principle of the circle of friends

Friends Circle, Sina Weibo, know well-known friends circle type function, have you ever thought about the logic of its realization?

This article takes the friend circle function as an example, parses the realization logic.

Structure of the Circle of Friends:

The circle of friends in general will be divided into 6 pieces of structure, the wall, users, pictures, wall stickers, comments and likes.

Wall: A public wall, all the wall stickers are located on it, if the app only realizes the friend Circle function, then the wall sticker actually can not be used, but if the app to realize the friend Circle, News circle and so on other kinds of wall paste type message, then the wall seems very necessary, At this point we need to create different walls to show the different types of wall stickers.

User: The user is the person who publishes The Wall post, comments and has a little praise. Without it, there is no way to develop a circle of friends.

Photo: When you publish a circle of friends, you often take one or more pictures, and the processing and presentation of the thumbnail image is an important detail.

Wall Stickers: The core object of a circle of friends, each user issued a wall sticker will be displayed on the wall, and a wall with one or more pictures, users can see their published wall paste content, and comments and likes.

Comments and likes: the user's action on a wall sticker, in which comments can be commented on before others leave comments.

The implementation of Wall stickers:

1. First we need to create an existing wall to send a request to the server (here we create it using the Curl command):


Curl-f "Name=friendwall" "Http://cloud.arrownock.com/v2/walls/create.json?key=appKey"



After creating the wall, we will get a wallid, and after all the users send a circle of friends, we all need to pass in the Wallid parameter.

2, send a circle of friends (here is an example of Android code to create Post)


    //Create a friend circle message     map<string, object> params =  new HashMap<String, Object> ();     params.put ("title",  title);     params.put ("wall_id",  wallid);     params.put ("user_id",  USERID);     params.put ("Content",  content);     Ansocial.sendrequest ("Posts/create.json", ansocialmethod.post, params,                                                                 new iansocialcallback ()  {         @Override         &nbsP;public void onsuccess (Jsonobject response)  {         //when a post is created successfully, you need to save the post data to the local database         }          @Override         public void  OnFailure (Jsonobject response)  {        //creation Failure          }    });




Here we create the post, will get the entire post data, we need to save it locally, after that, in order to reduce the user's traffic consumption, as long as the user has been using the same device with the friend Circle feature, we should not get this post data from the server.

May have a friend will ask, if we do not consider the user's traffic consumption problem, is it possible not to save the data to the database, each time to request the server? The answer is in the negative. The reason is that, even if we don't consider the problem of traffic consumption, the user experience is an extremely important factor in an app-flying era. Imagine this scenario: if the user is in a network is not fluent in the state, opened the previous view of the friend circle content, the result is a blank in the circle of friends, everything needs to be re-loaded, what can not see, what kind of user experience? Therefore, it is important to save the data locally.

How to implement the Circle of Friends feature in the App series article:

A brief analysis of the realization principle of circle of friends

Second, quickly realize the customization of user information

Three quick realization of two-way friend function

Four in the circle of friends to add the Send picture function

Five likes, comments attribute detailed analysis

The six-speed implementation of the pull-down load friend circle function

Seven fast implementation of pull-up load friends circle function

The logic and implementation of the eight page load function


This article from "Arrow Buckle technology Arrownock" blog, reproduced please contact the author!

How to implement a friend circle function in the app a brief analysis of the principle of the realization of the circle of friends--arrow Buckle technology Arrownock

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.