"Turn" Android Access Friends League

Source: Internet
Author: User

There are many dimensions of statistics, but the most basic new users and start times. Regarding this, it may be necessary to involve the life cycle and state change of Android activity. For a better understanding, a simple code attempt was made.

protectedvoid onCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate);        Setcontentview (R.layout.activity_main); LOG.E (TAG,"Enter OnCreate");} protectedvoid OnStart () {Super. OnStart (); LOG.E (TAG,"OnStart"); } @Override protectedvoid Onresume () {Super. Onresume (); LOG.E (TAG,"Onresume"); } @Override protectedvoid OnPause () {Super. OnPause (); LOG.E (TAG,"OnPause"); }  

And then did some experiments:
1. First launch application main activity has 3 state triggers, Oncreate,onstart,onresume

2. Press the home key to cut the app to the background, triggering onpause and OnStop

3. Press and hold the home button to find the application, re-cut back to the foreground, triggering onstart and Onresume


After looking at the friend Union's sample code found also based on this to statistics active users. OK, the following records the process of access to the Friends League statistics.

First, the need to add permissions in the Androidmanifest.xml and some configuration, mainly Appkey, this is registered on the Friend League website after the application can be added to obtain, Channel ID is defined by themselves.

<uses-permissionandroid:name= "Android.permission.INTERNET"/><uses-permissionandroid:name= " Android.permission.ACCESS_NETWORK_STATE "/> <uses-permissionandroid:name=" android.permission.READ_PHONE_ State "/> ... <meta-dataandroid:value= "535f487******" android:name= "Umeng_appkey" ></meta-data>< Meta-dataandroid:value= "Test001" android:name= "Umeng_channel"/></application>

Then add the corresponding code to the activity, Mobclickagent class.

 import   Com.umeng.analytics.mobclickagent;protectedvoid onCreate (Bundle savedinstancestate) { super  .oncreate (Savedinstancestate); Mobclickagent.updateonlineconfig ( this   super  .on              Resume ();             LOG.E (TAG,  "Onresume" );        Mobclickagent.onresume (Mcontext);} Protectedvoid OnPause () { super  .onpause          ();         LOG.E (TAG,  "OnPause" );  Mobclickagent.onpause (Mcontext);} 

The Umeng jar package needs to be added to the project.



However, after doing this in eclipse, it is found that an error has been encountered and a statement executed to Mobclickagent is abnormal, as shown below. Official documentation only mentions the above steps.



The solution is to put the Umeng jar package into the Libs directory of the project.




Next, the app runs, and you'll see the data in a few minutes.



Number of launches this is because it is statistically onresume (), so there are some details that need to be noted to see if adjustments are needed.



You can see the results of the channel, which was previously configured in Androidmanifest.xml.





Some of the equipment information can not be viewed today's results, the next day to see, or more accurate.






In addition, the following custom event was also tested. My Demo app has two sections to access the HTTP interface, respectively, via Apache HttpClient and Android HttpClient, to count down the number of cuts and response times.

Embed the corresponding code before and after the call.
Mobclickagent.oneventbegin (This, "android_http_visit");
Mobclickagent.oneventend (This, "android_http_visit");




Overall, the basic statistical function is also good, the development is also very convenient, than previously imagined to be more convenient. But with the data analysis of the self-developed BI tools used in our actual product, and the fact that we know about the large-scale actual use of our products, some partial application-level functions are not particularly sufficient. For example, detailed user access path aspects.
Here are some basic models to be given. But if the product and operation to do a very detailed analysis also need to do some work.



Funnel models and so on because the demo app is too simple to continue in-depth understanding. Understanding it and finding out how to read the operational data of the actual product will make it easier to understand.

Transferred from: http://blog.csdn.net/superqa/article/details/24808107

"Turn" Android Access Friends League

Related Article

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.