Nir
Nir

Reputation: 1678

Google Analytics for android doesnt work from real device

I integrated the GoogleAnalyticsTracker following the instruction on the official SDK page and run it on my AVD. Everything works and looks great.

However, after installing my app on a real device (galaxy s2) I noticed no statistics are generated at all. AVD works, real device doesn't (I can see access on the real-time dashboard)

Device has full internet access at all times Any ideas?

[EDIT] Code included

myActivity

public void onCreate(...) {
  GoogleAnalyticsTracker t = GoogleAnalyticsTracker.getInstance();

  t.startNewSession("UA-xxxxxxxx-xx", this);
  t.setCustomVar(1, "somevar", "value2", 2);
  t.trackEvent("someevent", "startup", "desc", 2);
}

public void onPause(...) {
  GoogleAnalyticsTracker.getInstance().dispatch();
}

myView (on menu display)

GoogleAnalyticsTracker.getInstance().trackPageView("/menu");

Upvotes: 0

Views: 492

Answers (1)

Nir
Nir

Reputation: 1678

Problem solved... It appears that my hosts file was modified by my custom ROM and that google analytics was blocked. Replacing it with a clean file solved the problem

Upvotes: 2

Related Questions