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)
- Ensure that all activity calls
MobclickAgent.onResume()
and MobclickAgent.onPause()
methods are
- 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
- 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)
- 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.
@Override publicvoid Onresume () { super. Onresume () ; Mobclickagent.onresume (this); } @Override publicvoid onPause () { super. OnPause ( ); Mobclickagent.onpause (this); }
Page Stats
- Only the Activity app: Just add the session stats code
- 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
- Count events, number of occurrences of statistics
Mobclickagent.onevent (context context, String eventId);
- 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
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
- upper right corner Check app
- Click on "Components"
- 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:
- customizing layout pages
- 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