Android-uses the Ring letter SDK to develop instant messaging (with source download) _android

Source: Internet
Author: User
Tags call back constant inheritance

Recently, the integration of real-time chat in the project, pick and choose, the final choice of the Ring Letter SDK for development, the main reason to choose the ring letter is the interface is convenient, concise, explain the document clear and understandable. The documentation has Android, IOS, and backend server, or it's very full.

Ring Letter Official Website: http://www.easemob.com/

The purpose of this article is to explain how the ring letter demo to achieve instant messaging. I am in the integration of the Ring Letter SDK to our own development of the app, studied the ring letter demo code, looked two or three days, the basic understanding of the ins and outs, but only clear the ins and outs, to say that the details inside may be a step further study, but this is enough, It's already possible to integrate the functionality of the demo into our own app. So this article explains how to integrate the ring letter into your app.

Integration is still relatively fast, up to one week time integration is done. We have our own user system, so we use the link letter with the existing app user system integration.

Before integration, it is necessary to go to the above page to understand, how to integrate, here explains how to integrate the solution, the choice of this option will require you to choose according to the existing needs. This is not much to say, it should be understood.

Login principle

Our solution is to integrate the ring letter with the existing app user system! In other words, our servers need to register the existing users in the background to the Ring letter server, and then the app login automatically log on to the ring server, and then use the Ring letter Instant Messaging function.

This means that users login app, need to log in two times, one is our application server, one is the ring letter server, but to the user's feeling is logged in once, and the ring letter server login is controlled by the code, the user can not see nor feel.

Friends System principle

After login, is to get friends and groups, the ring letter increased the function of the chat room, a bit similar to the function of pine group, but chat room more casual. Group Everyone understand, not much to say, chat room, open public chat room, members can enter the chat at any time to leave, after leaving automatically no longer receive chat information.

The friend system in the ring letter can be managed, of course, can not use the ring letter of the friend Management system, and the use of application server for the management of friends. Our project is the use of the ring letter of the friend management system, mainly convenient, but also does not necessarily save the number of things, because the application server user system changes, the user system will be the server to notify the change of the relationship between the server, but the ring letter server also make changes, Thus maintaining the consistency of the application server and the user system of the ring letter server. So we need to consider the cost of our integration process. Our project uses the Ring letter management friend system mainly lies in the app end convenient, the app end also does not carry on the user system the change, the complex operation all realizes in the server side, therefore the app end facilitates realizes, the development is simple.

User nickname, Avatar

Ring Letter Server uses a low immersion way to develop instant communication, that is, it does not save the user's information, nor access to the user's information, which means that the user's nickname, Avatar and so on information ring letter is not saved, developers can not obtain user information through the ring letter. Therefore, the ring letter specifically to the user's nickname, Avatar information given a solution.

method to get nickname and Avatar from App server

Method two gets the nickname and Avatar from the message extension

Nickname or avatar processing method one and method two differences:

Method one: When sending a message without any extensions, if the sender's user information does not exist locally, the URL of the sender's nickname and Avatar needs to be queried from the app server.

Method Two: When sending a message with a nickname and Avatar URL of the message extension, the message can be retrieved from the message extension, do not need to go to the app server access, method two and method one compared

Advantages: Receive the message immediately display the nickname without waiting for the app server to return data after the display.

Disadvantage: Each message should have an extension, increase the volume of the message, each send a message has some unnecessary data.

These are the two solutions to the user nickname and Avatar given by the ring letter. The two solutions that everyone can see on the application understand, not much to say. Mainly talk about our project solution, using the first scheme, from the application server to save the local database, after the query operation is local operation, that will have problems, user relations update or information update? The main solution to this problem is that each update of the user's buddy system updates the user's nickname and Avatar at the same time, and then updates the local database to solve the problem.

Now that the three questions are understood, the basics can start to develop, and you might say that there's no indication of instant messaging yet? The main thing is that instant communication is not explained? Don't worry about this problem, we'll have it later! ^_^

Development

The development process, the first is to study the ring letter demo code, which has been encapsulated, so the ring letter demo code to understand, the use of good code can be applied to the existing app.

This Ring letter demo code, import mobile phone directly run, register, with very good, the code runs normally, function is also normal, so study this code, and then integrated into their own app that so easy!!

There are several jar packs in the demo, is mainly the central letter of the SDK, Baidu map, friend League data analysis, Baidu map positioning, picture loading, such as several jar bags, Baidu Map This should have nothing to say, before we integrated the app, but a bit old, this time with the Baidu map also updated into the latest, At present, Baidu map of the latest very useful. is a lesson, is the real-time update of the application of the third party jar! The other jars have nothing to say.

The following is a demo inside the subcontract, demo inside the packet is more, but from the name of the subcontract can see each package the following code is what role. I mainly look at the activity package for each of the following classes, because the activity class is one of the interface, the other is for this activity class service Code tool class, so mainly to see this on it.

There are more analogies under the activity package, but we are concerned about only a few classes, the Chatactivity.java class is the interface of instant chat, this must be integrated into their own app. The other three Contactlistfragment.java, Chatallhistoryfragment.java, Groupsactivity.java these three classes are the contact interface, the reply history interface, the group interface respectively. These three need to be integrated according to the needs of their own app. So the main research work is to put on these several classes.

Mainactivity.java is the main interface, the main interface integrates the above three interfaces, the main interface for the display of the management interface.

The rest of the work is nothing special, do not understand the code can give me a message, communicate with each other.

Specifically mention the following classes

This couple of classes are a bit around! It was really confusing at first. Now it seems that the demo inside the code is also well-intentioned Ah!!

1, first look at the controller package under the Hxsdkhelper.java class, and then look at the Chatuidemo under the Demohxsdkhelper.java class, is obviously an inheritance relationship! The latter is the object class used in the demo. And the parent class is under the controller package, obviously the control information management class, open the class to view the code

The function of the class can be seen from the explanation.

2, look again Hxsdkmodel.java class, this kind of name is the template class, there are Defaulthxsdkmodel.java class and Demosdkmodel.java class, also obviously has the inheritance relation. The completion of the function is mainly in the app for real-time communication of some data storage and control information display information.
After these classes are clear, there is basically no question of how to fight.

Main code explanation

1, Main class Mainactivity.java

public class Mainactivity extends baseactivity implements Emeventlistener

This class implements the Emeventlistener interface, in a way that is as follows:

/**
   * Monitor event
   /
  @Override public
  void OnEvent (Emnotifierevent event) {
    switch (event.getevent ()) { Case
    Eventnewmessage://Plain News
    {
      Emmessage message = (emmessage) event.getdata ();
      Prompts for new messages
      hxsdkhelper.getinstance (). Getnotifier (). ONNEWMSG (message);
      Refreshui ();
      break;
    Case Eventofflinemessage: {
      refreshui ();
      break;
    Case eventconversationlistchanged: {
      refreshui ();
      break;

    Default: Break
      ;
    }
  }

The main is to listen to new messages, offline messages, message changes, and so on, and then update the interface Refreshui (), update the interface is to refresh the unread message number, refresh contact list, List of reports, and so on.

Three listeners were registered in the main interface initialization, the following code:

private void Init () {
    //Setcontactlistener listens for changes to contacts, etc.
    emcontactmanager.getinstance (). Setcontactlistener (New Mycontactlistener ());
    Registers a listener
    Connectionlistener = new Myconnectionlistener () with a listening connection state;
    Emchatmanager.getinstance (). Addconnectionlistener (Connectionlistener);

    Groupchangelistener = new Mygroupchangelistener ();
    Register group chat related listener
  }

These three listeners are listeners that listen for changes in their contacts, group changes, and links to the Ring letter server, and these changes will call back the corresponding methods in the three listeners, so that the developers can take appropriate measures by corresponding methods.

These three listeners demo code in more detail, this is not much to say.

2 Contact List Contactlistfragment.java class

/** * Contact List Page */public class Contactlistfragment extends Fragment {public static final String TAG = "Contactlistfrag
  ment ";
  Private Contactadapter adapter;
  Private list<user> contactlist;
  Private ListView ListView;
  Private Boolean hidden;
  Private Sidebar Sidebar;
  Private Inputmethodmanager Inputmethodmanager;
  Private list<string> blacklist;
  ImageButton ClearSearch;
  EditText query;
  Hxcontactsynclistener Contactsynclistener;
  Hxblacklistsynclistener Blacklistsynclistener;
  View ProgressBar;
  Handler Handler = new Handler ();
  Private User Tobeprocessuser;

  Private String Tobeprocessusername; /** * Here two listeners are registered to sync contact information * When the contact changes, blacklist changes, notify the registered listeners here * and then refresh the interface * * */class Hxcontactsynclistener Impl  Ements Hxsdkhelper.hxsynclistener {@Override public void Onsyncsucess (final Boolean success) {EMLOG.D (TAG,
      "On the Contact List Sync success:" + success); ContactlistFragment.this.getActivity (). Runonuithread (New RunnablE () {public void run () {getactivity (). Runonuithread (New Runnable () {@Override
                public void Run () {if (success) {progressbar.setvisibility (view.gone);
              Refresh ();
                }else{String S1 = getresources (). getString (R.string.get_failed_please_check);
                Toast.maketext (Getactivity (), S1, 1). Show ();
              Progressbar.setvisibility (View.gone);
        }
            }

          });
    }
      }); Class Hxblacklistsynclistener implements hxsynclistener{@Override public void Onsyncsucess (Boolean succe SS) {getactivity (). Runonuithread (New Runnable () {@Override public void run () {blacklist
          = Emcontactmanager.getinstance (). Getblacklistusernames ();
        Refresh ();
    }
      });

  }

  }; @Override public View Oncreateview (layoutinflater inflater, ViewGroup container, Bundle savedinstAncestate) {return inflater.inflate (R.layout.fragment_contact_list, container, false); @Override public void onactivitycreated (Bundle savedinstancestate) {super.onactivitycreated (savedinstancestate
    ); To prevent being T, no click on the button and then press the Home button, long in the background and into the app-led crash if (savedinstancestate!= null && savedinstancestate.getboolean ("
    IsConflict ", false) return;
    Inputmethodmanager = (Inputmethodmanager) getactivity (). Getsystemservice (Context.input_method_service);
    ListView = (ListView) GetView (). Findviewbyid (R.id.list);
    Sidebar = (sidebar) getview (). Findviewbyid (R.id.sidebar);

    Sidebar.setlistview (ListView);
    Blacklist list blacklist = Emcontactmanager.getinstance (). Getblacklistusernames ();
    ContactList = new arraylist<user> ();
    Gets the settings contactlist getcontactlist ();
    Search box query = (edittext) GetView (). Findviewbyid (R.id.query);
    Query.sethint (R.string.search);
ClearSearch = (ImageButton) GetView (). Findviewbyid (R.id.search_clear);    Query.addtextchangedlistener (New Textwatcher () {public void ontextchanged (charsequence s, int start, int before
        , int count) {adapter.getfilter (). filter (s);
        if (s.length () > 0) {clearsearch.setvisibility (view.visible);
        else {clearsearch.setvisibility (view.invisible);  } public void beforetextchanged (charsequence s, int start, int count, int in) {} public void
    Aftertextchanged (Editable s) {}}); Clearsearch.setonclicklistener (New Onclicklistener () {@Override public void OnClick (View v) {QUERY.G
        Ettext (). Clear ();
      Hidesoftkeyboard ();

    }
    });
    Set Adapter adapter = new Contactadapter (getactivity (), r.layout.row_contact, contactlist);
    Listview.setadapter (adapter); Listview.setonitemclicklistener (New Onitemclicklistener () {@Override public void Onitemclick (adapterview< ?> Parent, view view, int position, LonG ID) {String username = adapter.getitem (position). GetUserName (); if (Constant.NEW_FRIENDS_USERNAME.equals (USERNAME)) {//Enter application and notification page user = Demoapplication.getinst
          Ance (). Getcontactlist (). get (Constant.new_friends_username);
          User.setunreadmsgcount (0);
        StartActivity (New Intent (Getactivity (), newfriendsmsgactivity.class)); else if (Constant.GROUP_USERNAME.equals (USERNAME)) {//Enter the Group Chat list page startactivity (New Intent (Getactivit
        Y (), groupsactivity.class)); else if (Constant.CHAT_ROOM.equals (username)) {//Enter the chat room List page startactivity (New Intent (Getactivity (), Pu
        Blicchatroomsactivity.class)); }else {//demo directly into the chat page, the actual general is to enter the user Details page startactivity (New Intent (Getactivity (), chatactivity.class). Pute
        Xtra ("UserId", Adapter.getitem (position). GetUserName ());
    }
      }
    }); Listview.setontouchlistener (New Ontouchlistener () {@Override publiC Boolean Ontouch (View V, motionevent event) {//Hide the soft keyboard if (getactivity (). GetWindow (). GetAttributes (). Soft Inputmode!= WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {if (Getactivity (). Getcurrentfocus
                ()!= null) Inputmethodmanager.hidesoftinputfromwindow (Getactivity (). Getcurrentfocus (). Getwindowtoken (),
        Inputmethodmanager.hide_not_always);
      return false;

    }
    });
    ImageView Addcontactview = (ImageView) GetView (). Findviewbyid (R.id.iv_new_contact); Go to add Buddy page Addcontactview.setonclicklistener (new Onclicklistener () {@Override public void OnClick (View V
      ) {startactivity (New Intent (Getactivity (), addcontactactivity.class));
    }
    });

    Registerforcontextmenu (ListView);

    ProgressBar = (View) GetView (). Findviewbyid (R.id.progress_bar);
    Contactsynclistener = new Hxcontactsynclistener (); Hxsdkhelper.getinstance (). Addsynccontactlistener (ContactsyncListener);
    Blacklistsynclistener = new Hxblacklistsynclistener ();

    Hxsdkhelper.getinstance (). Addsyncblacklistlistener (Blacklistsynclistener); if (!
    Hxsdkhelper.getinstance (). Iscontactssyncedwithserver ()) {progressbar.setvisibility (view.visible);
    else {progressbar.setvisibility (view.gone); @Override public void Oncreatecontextmenu (ContextMenu menu, View V, contextmenuinfo menuinfo) {Super.oncre
    Atecontextmenu (menu, V, menuinfo); if (((Adaptercontextmenuinfo) menuinfo). Position > 2) {tobeprocessuser = Adapter.getitem (((Adaptercontextmenuinf
      o) menuinfo). Position);
      Tobeprocessusername = Tobeprocessuser.getusername ();
    Getactivity (). Getmenuinflater (). Inflate (r.menu.context_contact_list, menu); @Override public boolean oncontextitemselected (MenuItem item) {if Item.getitemid () = = R.id.delete_contact
        {try {//delete this contact deletecontact (tobeprocessuser);
     Delete a related invitation message   Invitemessgedao dao = new Invitemessgedao (getactivity ());
      Dao.deletemessage (Tobeprocessuser.getusername ());
      catch (Exception e) {e.printstacktrace ();
    return true;
      }else if (item.getitemid () = = R.id.add_to_blacklist) {movetoblacklist (tobeprocessusername);
    return true;
  return super.oncontextitemselected (item);
   /** * The system calls this method when the fragment object changes the hidden state (returned by the Ishidden () method).
   * Fragment initial is not hidden, the method is invoked as long as the fragment object changes its display state.
   * parameter hidden if the fragment object is now hidden, the argument is true, otherwise it is false.
    * * @Override public void onhiddenchanged (Boolean hidden) {super.onhiddenchanged (hidden);
    This.hidden = hidden;
    if (!hidden) {refresh ();
    @Override public void Onresume () {super.onresume ();
    if (!hidden) {refresh ();
    }/** * Delete contact * * @param todeleteuser/public void DeleteContact (final User tobedeleteuser) { String st1 = Getresources (). getString (r.string.deleting);
    Final String st2 = Getresources (). getString (r.string.delete_failed);
    Final ProgressDialog pd = new ProgressDialog (getactivity ());
    Pd.setmessage (ST1);
    Pd.setcanceledontouchoutside (FALSE);
    Pd.show (); New Thread (New Runnable () {public void run () {try {emcontactmanager.getinstance (). deletecontact
          (Tobedeleteuser.getusername ());
          Delete db and in-memory this user's data Userdao DAO = new Userdao (getactivity ());
          Dao.deletecontact (Tobedeleteuser.getusername ());
          Demoapplication.getinstance (). Getcontactlist (). Remove (Tobedeleteuser.getusername ());
              Getactivity (). Runonuithread (New Runnable () {public void run () {Pd.dismiss ();
              Adapter.remove (Tobedeleteuser);

            Adapter.notifydatasetchanged ();
        }
          });
              The catch (Final Exception e) {getactivity (). Runonuithread (New Runnable () {public void run () { Pd.dismiss ();
            Toast.maketext (Getactivity (), St2 + e.getmessage (), 1). Show ();

        }
          });

  }}). Start (); /** * Move user to blacklist/private void Movetoblacklist (final String username) {Final ProgressDialog PD = new P
    Rogressdialog (Getactivity ());
    String st1 = Getresources (). getString (R.string.is_moved_into_blacklist);
    Final String st2 = Getresources (). getString (r.string.move_into_blacklist_success);
    Final String st3 = Getresources (). getString (R.string.move_into_blacklist_failure);
    Pd.setmessage (ST1);
    Pd.setcanceledontouchoutside (FALSE);
    Pd.show (); New Thread (New Runnable () {public void run () {try {//Join to blacklist Emcontactmanager.getinsta
          nCE (). Addusertoblacklist (Username,false);
              Getactivity (). Runonuithread (New Runnable () {public void run () {Pd.dismiss ();
              Toast.maketext (Getactivity (), ST2, 0). Show ();
   Refresh ();         }
          });
          catch (Easemobexception e) {e.printstacktrace ();
              Getactivity (). Runonuithread (New Runnable () {public void run () {Pd.dismiss ();
            Toast.maketext (Getactivity (), ST3, 0). Show ();
        }
          });

  }}). Start (); 
        //Refresh UI public void Refresh () {try {///may be transferred to this method Getactivity () in a child thread). Runonuithread (New Runnable () {
          public void Run () {getcontactlist ();
        Adapter.notifydatasetchanged ();
    }
      });
    catch (Exception e) {e.printstacktrace (); @Override public void OnDestroy () {if (Contactsynclistener!= null) {hxsdkhelper.getinstance (). Remo
      Vesynccontactlistener (Contactsynclistener);
    Contactsynclistener = null; } if (Blacklistsynclistener!= null) {hxsdkhelper.getinstance (). Removesyncblacklistlistener (Blacklistsynclistener
    );
  } Super.ondestroy ();

  }public void Showprogressbar (Boolean show) {if (ProgressBar!= null) {if (show) {Progressbar.setvisibi
      Lity (view.visible);
      else {progressbar.setvisibility (view.gone);
    }}/** * Get contact list and filter out blacklist and sort/private void getcontactlist () {contactlist.clear ();
    Get local buddy list map<string, user> users = Demoapplication.getinstance (). Getcontactlist ();
    iterator<entry<string, user>> iterator = Users.entryset (). iterator ();
      while (Iterator.hasnext ()) {entry<string, user> Entry = Iterator.next (); if (!entry.getkey (). Equals (Constant.new_friends_username) &&!entry.getkey (). Equals (Constant.group_usern AME) &&!entry.getkey () equals (Constant.chat_room) &&!blacklist.contains (Entry.getkey
        ()) {emlog.i (TAG, "Get contact =" +entry.getvalue ());
      Contactlist.add (Entry.getvalue ()); }//Sort collections.sort (contactlist, NEW comparator<user> () {@Override public int compare (user lhs, user rhs) {return Lhs.getusernam
      E (). CompareTo (Rhs.getusername ());

    }
    });
    Add "group chat" and "chat room" if (Users.get (constant.chat_room)!= null) contactlist.add (0, Users.get (constant.chat_room));

    if (Users.get (constant.group_username)!= null) contactlist.add (0, Users.get (constant.group_username)); Add "request and notify" to the first if (Users.get (constant.new_friends_username)!= null) contactlist.add (0, Users.get (constant.new_
  Friends_username)); } void Hidesoftkeyboard () {if (Getactivity (). GetWindow (). GetAttributes (). Softinputmode!= WINDOWMANAGER.L Ayoutparams.soft_input_state_hidden) {if (Getactivity (). Getcurrentfocus ()!= null) inputmethodmanager.hides
    Oftinputfromwindow (Getactivity (). Getcurrentfocus (). Getwindowtoken (), inputmethodmanager.hide_not_always);
    @Override public void Onsaveinstancestate (Bundle outstate) {Super.onsaveinstancestate (outstate);
    if (((mainactivity) getactivity ()). IsConflict) {Outstate.putboolean ("isconflict", true); }else if (((mainactivity) getactivity ()). Getcurrentaccountremoved ()) {Outstate.putboolean (constant.account_removed
    , true);

 }

  }
}

The registered listener in contact with the human is using the Observer mode, look at some of the code in the Hxsdkhelper.java

public void Addsyncgrouplistener (Hxsynclistener listener) {if (listener = = null) {return;
    } if (!syncgroupslisteners.contains (listener)) {Syncgroupslisteners.add (listener);
    } public void Removesyncgrouplistener (Hxsynclistener listener) {if (listener = = null) {return;
    } if (Syncgroupslisteners.contains (listener)) {Syncgroupslisteners.remove (listener);
    } public void Addsynccontactlistener (Hxsynclistener listener) {if (listener = = null) {return;
    } if (!synccontactslisteners.contains (listener)) {Synccontactslisteners.add (listener);
    } public void Removesynccontactlistener (Hxsynclistener listener) {if (listener = = null) {return;
    } if (Synccontactslisteners.contains (listener)) {Synccontactslisteners.remove (listener);
    } public void Addsyncblacklistlistener (Hxsynclistener listener) {if (listener = = null) {return; } if (!syncBlacklistlisteners.contains (Listener)) {Syncblacklistlisteners.add (listener);
    } public void Removesyncblacklistlistener (Hxsynclistener listener) {if (listener = = null) {return;
    } if (Syncblacklistlisteners.contains (listener)) {Syncblacklistlisteners.remove (listener);
      }} public void Noitifygroupsynclisteners (Boolean success) {for (Hxsynclistener listener:syncgroupslisteners) {
    Listener.onsyncsucess (Success);  }} public void Notifycontactssynclistener (Boolean success) {for (Hxsynclistener listener:synccontactslisteners)
    {listener.onsyncsucess (success); }} public void Notifyblacklistsynclistener (Boolean success) {for (Hxsynclistener Listener:syncblacklistlistene
    RS) {listener.onsyncsucess (success);

 }
  }

This part of the code controls the Observer, adds, deletes, notifies each observer, notify each observer after the group, friends, and blacklist are synchronized to the client through the Ring letter server, and then the viewer receives the UI and refreshes it. This is the classic application of the Observer model!!!
After the contact list is understood, the other group interface and the conversation history interface are not much to say.

3 Chat Interface Chatactivity.java

This class is relatively large, because the demo inside the single chat and group chat, chat rooms are integrated into this interface to complete, the code is very large, but does not affect the final integration, direct integration of the class can realize the function. Don't say much.

Attached interface:


Figure One reply history interface


Figure two Address Book interface friend


Figure Three Settings interface

Figure Four Chat interface

Finally attach source download

Add:

Ring Letter Official website has released IM3.0 version. One of the apps currently being developed is the IM3.0 version.

The overall interface has not changed greatly, and the function is the same. But in the official demo code on the optimization of a lot of convenience. But I have to probably understand the code inside. If it is a master, half a day should be able to integrate a good ring letter instant Messaging function.

This article gives the download link, is the IM2.0 version. So if you want to use the IM3.0 version, you need to go to the website to download.

For beginners, the ring letter on the official website of the demo can be used directly. The whole app code is given. Novice is puzzled, do not know how to start integrated instant communication function?

It's actually very simple!

First of all, the ring letter to the official website to add the dependencies and dynamic library to their own projects. The current official website gives the dependency package and the dynamic library is divided into contains voice video call function and does not include voice video call function. Everyone is adding to your app's capabilities.

Then, the demo inside the chat interface directly copied to their functions inside, at this time after the copy into, there will be a lot of mistakes! Because the chat interface is associated with many other classes in the demo, you want to copy other classes into your project. Remember to not forget layout files, resource picture files, strings and so on resource files! Recommendation: In your own project, create a new class that is dedicated to the ring letter. Because you want to copy a lot of classes! There are about twenty or thirty!

Finally, populate the Instant Messaging code with the data. There are several main parts:

1) Application class in the Ring letter Helper class completes the initialization operation.

2 Login to the app interface to do the login server operation. Login name and password required to log in to the ring letter. The Ring letter login here is different from the login app. App login is the user of the application server, username and password on the application server. and the login ring letter is the login name and password of the ring letter, need to register to the ring letter server first. The registration operation can be done in advance of the application server. App Login to the application server with the login ring letter server can be.

3 Get friend information. Here to be divided into friend information maintenance is the application of server maintenance or ring letter to help you maintain. I don't have to say much about that. Ring Letter Official website has the explanation.

4 Local maintenance buddy list and chat information in the list. The chat information list has not been edited and changed by the developer in the ring letter. This feature has been integrated into the bundle of dependent ring letters. The buddy list gives a simple datasheet in the demo. Developers can develop and expand themselves according to the needs of the app.

5 quit App. Be sure to invoke the helper class logout method when exiting the app. After that, the previously logged-on user exits the ring letter server from the app. Developers should note that when I say exit, the app user exits manually, not when the user presses the phone back button or returns to the main interface button, causing the app to quit. Instead, the Exit button in app, the currently logged-on user, exits the app. If the user presses the return button or back to the main interface button, return to the mobile desktop, there is no need to invoke helper class logout method.

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.