Rong Yun Rongyun

Source: Internet
Author: User

Manifest.xml content
<!--begin Imlib Request--<service android:name= "Io.rong.push.PushService" Androi d:process= "Io.rong.push" > <!--waring:the name of the push process can not be changed!!!                -<intent-filter> <category android:name= "Android.intent.category.DEFAULT"/>        <action android:name= "Io.rong.push"/> </intent-filter> </service>  <service android:name= "Io.rong.push.CommandService" android:process= "Io.rong.push" > <!-- Waring:the name of the push process can not be changed!!!                -<intent-filter> <category android:name= "Android.intent.category.DEFAULT"/>        <action android:name= "Io.rong.command"/> </intent-filter> </service> <receiver android:name= "Io.rong.push.PushReceiver" android:process= "Io.rong.push" > <!--waring:the name of the push process can changed!!!             -<intent-filter> <action android:name= "Io.rong.imlib.action.push.heartbeat"/> </intent-filter> <intent-filter> <action android:name= "android.net.co Nn. Connectivity_change "/> </intent-filter> <intent-filter> <action an                 Droid:name= "Android.intent.action.BOOT_COMPLETED"/> </intent-filter> <intent-filter> <action android:name= "Android.intent.action.USER_PRESENT"/> <action android:name= "Android.intent.action.ACTION_POWER_CONNECTED"/> <action android:name= "android.intent.action.ACTION_ Power_disconnected "/> </intent-filter> <intent-filter> <action and               Roid:name= "Android.intent.action.PACKAGE_REMOVED"/> <data android:scheme= "package"/> </intent-filter> </receiver> <activity        Android:name= "Io.rong.imkit.tools.SelectPictureActivity" android:screenorientation= "Portrait"/> <activity android:name= "Io.rong.imkit.tools.PreviewPictureActivity" Android:screenorientatio n= "Portrait"/> <activity android:name= "io.rong.imkit.tools.RongWebviewActivity" Androi d:screenorientation= "Portrait"/> <activity android:name= "io.rong.imkit.widget.provider.TakingPict Uresactivity "android:configchanges=" Orientation|keyboardhidden "android:screenorientation=" Portrait        "/> <service android:name=" Io.rong.imlib.ipc.RongService "android:process=": IPC "> </service> <service android:name= "Io.rong.imlib.ReConnectService"/> <receiver Android : Name= "Io.rong.imlib.ConNectchangereceiver "/> <receiver android:name=" Io.rong.imlib.ipc.PushMessageReceiver "> <int        ent-filter> <action android:name= "Io.rong.push.message"/> </intent-filter> </receiver> <receiver android:name= "Io.rong.imlib.HeartbeatReceiver" Android:proce  Ss= ": IPC"/> <meta-data android:name= "Rong_cloud_app_key" android:value= "P5tvi9dst1t34" /> <!--End-














Melt Cloud API various requests Get&post
Registered
Sign in to get token
Login (OBSOLETE)
Get token and need to log in first (obsolete)


Get a list of groups
Get a list of groups I've joined
Get group information based on group ID
Update group Information
Join a group
Exit Group


Get Friends List
Send friend Invitations
Handling easy-to-use requests
Delete Friends
Query users by name






The simplest case
Application initialization:
public class App extends application {
@Override
public void OnCreate () {
Super.oncreate ();
Rongim.init (this);
}
}
Activity
Private String token = "x7mn+e8khkaw+tlz519bc9mexvx6ef51pnifnvhhxfawzipqmrng5uhgheqyaiqmxt3og2sgtv3/ami9xpsaxg==";
Start connection
Rongim.connect (token, new Rongimclient.connectcallback () {
/**
* Token error, the online environment is mainly because the Token has expired, you need to re-request to the APP Server a new
* Token
*/
@Override
public void Ontokenincorrect () {
LOG.I ("My", "--ontokenincorrect");
}
/**
* Connect to Cloud Success
* @param userid
* Current Token
*/
@Override
public void onsuccess (String userid) {
LOG.I ("My", "--onsuccess" + userid);
}
/**
* Failed to connect to cloud
* @param errorCode
* Error code, you can check the error code corresponding to the official note
*/
@Override
public void OnError (Rongimclient.errorcode ErrorCode) {
LOG.I ("My", "--onerror" + ErrorCode);
}
});
Start the Session list interface
Rongim.getinstance (). Startconversationlist (this);


Start the session interface
Rongim.getinstance (). Startprivatechat (This, "y1235", "title");










General case
Rongcloudevent.init (this);//initialization
Thread.setdefaultuncaughtexceptionhandler (New Rongexceptionhandler (this));//exception


Rongim.registermessagetype (Agreedfriendrequestmessage.class);//type of registration message
Rongim.registermessagetemplate (New Contactnotificationmessageprovider ());//templates for registering messages
Rongim.registermessagetemplate (New Realtimelocationmessageprovider ());
@ Message Template Show
Rongcontext.getinstance (). Registerconversationtemplate (New Newdiscussionconversationprovider ());




/**
* Login to Demo server
*
* @param Email
* @param password
* @param callback 1 Guan Yu 2, Zhang Fei
* @return
*/
Public abstracthttprequest<user> Logintoken (string email, string password, apicallback<user> callback) {




list<namevaluepair> namevaluepairs = new arraylist<namevaluepair> ();
Namevaluepairs.add (New Basicnamevaluepair ("email", email));
Namevaluepairs.add (New Basicnamevaluepair ("password", password));
Namevaluepairs.add (New Basicnamevaluepair ("env", "1"));


apireqeust<user> apireqeust = new Defaultapireqeust<user> (Apireqeust.post_method, URI.create (HOST + DEMO_ Login_email_token), Namevaluepairs, callback);
Abstracthttprequest<user> HttpRequest = apireqeust.obtainrequest (new gsonparser<user> (User.class), Mauthtype);
Networkmanager.getinstance (). Requestasync (HttpRequest);
return HttpRequest;
}
... ... ... ...


Many common methods, can see Demoapi.java


Rongcloudevent.java contains many time callback methods. ☆☆☆☆☆















Rong Yun Rongyun

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.