找回密码
 立即注册
ActivityStatServiceAndroidonResume | android开发 2022-05-21 105 0star收藏 版权: . 保留作者信息 . 禁止商业使用 . 禁止修改作品
Android应用源码百度统计例子
百度统计功能的例子代码很少,需要有自己的百度帐号 可以去百度后台查看软件的情况

package com.example.baiducount;

import android.app.Activity;
import android.os.Bundle;

import com.baidu.mobstat.StatService;

/*
*
* 百度统计的Demo
*/
public class MainActivity extends Activity {

        @Override
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);
        }

        public void onResume() {
                super.onResume();

                /**
                 * 页面起始(每个Activity中都需要添加,如果有继承的父Activity中已经添加了该调用,那么子Activity中务必不能添加)
                 * 不能与StatService.onPageStart一级onPageEnd函数交叉使用
                 */
                StatService.onResume(this);
        }

        public void onPause() {
                super.onPause();

                /**
                 * 页面结束(每个Activity中都需要添加,如果有继承的父Activity中已经添加了该调用,那么子Activity中务必不能添加)
                 * 不能与StatService.onPageStart一级onPageEnd函数交叉使用
                 */
                StatService.onPause(this);
        }
}


(Android application source code Baidu statistical example
There are few example codes of Baidu statistical function. You need to have your own baidu account. You can go to Baidu background to check the software
package com. example. baiducount;
import android. app. Activity;
import android. os. Bundle;
import com. baidu. mobstat. StatService;
/*
*
*Demo of Baidu statistics
*/
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super. onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void onResume() {
super. onResume();
/**
*Page start (each activity needs to be added. If the call has been added in the inherited parent activity, it must not be added in the child activity)
*Cannot be associated with statservice Onpagestart and onpageend functions of the first level are used interchangeably
*/
StatService. onResume(this);
}
public void onPause() {
super. onPause();
/**
*End of page (each activity needs to be added. If the call has been added in the inherited parent activity, it must not be added in the child activity)
*Cannot be associated with statservice Onpagestart and onpageend functions of the first level are used interchangeably
*/
StatService. onPause(this);
}
})

[下载]13575260011.rar




上一篇:Android应用源码安卓拍照上传实现代码附带php端
下一篇:Android应用源码猜猜红桃A