我正在尝试将Google Analytics集成到我的应用中,但它并没有向我发送报告或任何内容。我按照谷歌的this指南,将.jar文件粘贴到我的libs文件夹中,设置构建路径,我做了导游告诉我的所有内容,但我什么都没得到。我没有错误,但是当我在模拟器上运行它时,我没有得到任何报告,并且log-cat没有显示任何内容。难道我做错了什么? 谢谢!!
MY MAIN ACTIVITY CLASS:
public class StartingPoint extends Activity {
public class myTrackedActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void onStart() {
super.onStart();
// The rest of your onStart() code.
EasyTracker.getInstance().activityStart(this); // Add this method.
}
@Override
public void onStop() {
super.onStop();
// The rest of your onStop() code.
EasyTracker.getInstance().activityStop(this); // Add this method.
}
}
public final static String EXTRA_MESSAGE = "com.primarycode.punnyjokes.MESSAGE";
//public static int iteration = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_starting_point);
}
我的价值观中的ANALYTICS.XML
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<!--Replace placeholder ID with your tracking ID-->
<string name="ga_trackingId">UA-43160348-1</string>
<!--Enable automatic activity tracking-->
<bool name="ga_autoActivityTracking">true</bool>
<bool name="ga_dryRun">false</bool>
<!--Enable automatic exception tracking-->
<bool name="ga_reportUncaughtExceptions">true</bool>
</resources>
答案 0 :(得分:0)
您忘记了启动EasyTracker。在项目的Application类的onCreate中执行此操作。
onCreate(){
super.onCreate();
EasyTracker.getInstance().setContext(this);
}