How to use each plug-in of friends Union

Source: Internet
Author: User

Need to get the appkey of the app before using the features provided by the Allies

One: Application statistics

Development Documentation: Http://dev.umeng.com/analytics/android-doc/integration

Session Statistics

Called in the Onresume method of each activity MobclickAgent.onResume(Context) , called in the OnPause methodMobclickAgent.onPause(Context)

  1. Ensure that all activity calls MobclickAgent.onResume() and MobclickAgent.onPause() methods are
  2. Do not add OnPause and Onresume methods in parent and child activity at the same time, which will result in duplicate statistics, resulting in abnormally higher boot times
  3. When the app is running in the background for more than 30 seconds (the default) and then back to the front end, it will be considered to be two separate sessions (boot), such as the user going back to home, or going to another program, after a period of time before returning to the previous application. Available via interface: MobclickAgent.setSessionContinueMillis(long interval) Customize this interval (parameter units in milliseconds)
  4. Call the Process.kill or System.exit method to kill the process before calling the Mobclickagent.onkillprocess (context) method, which is used to save the statistics.
  5.     @Override    publicvoid  Onresume () {        super. Onresume () ;        Mobclickagent.onresume (this);    }    @Override    publicvoid  onPause () {        super. OnPause ( );        Mobclickagent.onpause (this);    }
Page Stats
    1. Only the Activity app: Just add the session stats code
    2. Apps that contain activity, Fragment, and view
  • use  , onresume   and   onPause   method Statistics, This is the same as in the basic statistics (for activity)  
     public   void   Onresume () { super  .onresume ();       Mobclickagent.onresume ( this ); //  statistic length      OnPause () { super  .onpause (); Mobclickagent.onpause ( this  );}  

     

  • Usage onPageStart and onPageEnd Method statistics page (for page, page may Activity or may be Fragment View )
     Public void Onresume () {    super. Onresume ();    Mobclickagent.onpagestart (// statistics page }publicvoid  OnPause () {    super. OnPause ();    Mobclickagent.onpageend ("Mainscreen"); }

Statistics of behavior
    1. Count events, number of occurrences of statistics
      Mobclickagent.onevent (context context, String eventId);

    2. Calculate events, statistical values of the value of the distribution of variables, such as the duration of the event, the amount of each payment, etc., can call the following methods:
      int du)
      Example: Statistics once music playback, including music type, author and time of play, can be called after the end of the music playback:
      int// developers need to calculate their own music playback duration new hashmap<string, string>();  Map_value.put ("type", "popular"); Map_value.put ("artist", "Jjlin"); Mobclickagent.oneventvalue (This, "music", map_value, duration);

Online parameters

On-line parameters allow you to dynamically configure parameter values for predefined parameters on your Web site. For example: Dynamically modify the application's welcome, modify the switch option in the app "on" or "off", and similar to the game in the price of virtual items.

Need to be added to the portal of the program Activity

    

Mobclickagent.updateonlineconfig (Mcontext);

"XXXX");
Error statistics

Used after the Try-catch catches an exception

 Public Static void ReportError (Context context, String error)    // or    Public Static void ReportError (context context, throwable e)

Second: Automatic Update advantages
    • Fast integration, adding a single line of code to integrate auto-update components. When a developer needs to publish a new version, upload the latest installation package in the background, fill in the update, and the older version will receive the upgrade prompt.
      Just add it where you need it.
      Umengupdateagent.update (this);
    • Traffic optimization and experience optimization, developers can set up only in a specific network environment (such as WiFi) to update, priority to use the local downloaded installation package, to save valuable traffic for users. You can also set the time interval for version update detection to prevent frequent pop-up update prompts.
    • Update by channel, Android platform publishing channels are numerous, update cumbersome, friends of the auto-update support different channels to update different upgrade packages, effectively improve operational efficiency.
    • Incremental update, the Android Platform SDK supports incremental updates after version 2.0, and the default download of incremental packages saves time and traffic.
    • Diverse presentation: Developers can customize a variety of UI styles.
Principle

The AU auto update service first compares the app version information on the user terminal with the app version information uploaded by the developer on the friend's server. If the server has a higher version of the app, the user will be prompted to have a new version of the app (prompted as shown, the developer can customize the interface). After the user chooses to update, the Friends Auto update starts to download the new version of the app, and then installs the app.

Upload App

  

    1. upper right corner Check app
    2. Click on "Components"
    3. Click "Automatic Update" on the right menu.
Manual update
Umengupdateagent.setupdateautopopup (FALSE); Umengupdateagent.setupdatelistener (New Umengupdatelistener () {    @Override public    void onupdatereturned (int Updatestatus,updateresponse updateInfo) {        switch (updatestatus) {case        Updatestatus.yes://have update            Umengupdateagent.showupdatedialog (Mcontext, updateInfo);            break;        Case updatestatus.no://Have no update            toast.maketext (Mcontext, "No Update", Toast.length_short). Show ();            break;        Case Updatestatus.nonewifi://None WiFi            toast.maketext (mcontext, "No wifi connection, only updates under WiFi", Toast.length_short). Show ();            break;        Case Updatestatus.timeout://Time Out            Toast.maketext (mcontext, "timeout", Toast.length_short). Show ();            Break;}}    ); Umengupdateagent.update (this);
Custom Updates

To modify a customization file: Umeng_update_dialog.xml

Three: User feedback

Use the default feedback feature

Jump to the Friends Union default feedback page
Mfeedbackagent.startfeedbackactivity ();

Reply notification
Mfeedbackagent.sync ();

Custom Feedback:

  1. customizing layout pages
  2. Set up user information
    UserInfo info =agent.getuserinfo ();if(Info = =NULL) Info=NewUserInfo (); Map<string, string> contact =info.getcontact ();if(Contact = =NULL) Contact=NewHashmap<string, string>(); String Contact_info=Contactinfoedit.geteditabletext (). toString (); Contact.put (Key_umeng_contact_info_plain_text, CONTACT_INFO); Contact.put ("Email", "*******");//contact.put ("QQ", "*******");//contact.put ("Phone", "*******");//contact.put ("plain", "*******");info.setcontact (contact);//optional, setting user gender information.Info.setagegroup (1); Info.setgender ("Male");//Info.setgender ("female");Agent.setuserinfo (info);NewThread (NewRunnable () {@Override Public voidrun () {Booleanresult =Fb.updateuserinfo (); }}). Start ();

  

How to use each plug-in of friends Union

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.