ali
ali

Reputation: 161

Google analytics does not work on android

I want to import google analytics on my android application and my codes is

private GoogleAnalyticsTracker tracker;

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

    tracker = GoogleAnalyticsTracker.getInstance();
    tracker.startNewSession(getString(R.string.analytics_id), this);
    tracker.trackPageView("/demo");
}

@Override
protected void onDestroy() {
    super.onDestroy();
    tracker.stopSession();
}

but it is not working... where am I doing wrong? Thanks... Note: I used tabactivity and each of tab codes like that...

Upvotes: 0

Views: 6066

Answers (2)

ali
ali

Reputation: 161

I found the answer from this blog. Hope it's helpful.
http://blog.blundellapps.com/google-analytics-common-problems-and-fixes/

Upvotes: 9

Padma Kumar
Padma Kumar

Reputation: 20041

To Setup

// Add libGoogleAnalytics.jar to your project's /libs directory.

// Add the following permissions to your project's AndroidManifest.xml manifest file:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

EDIT: In order to use Google Analytics, you must be signed in with a registered Google Account email address and password.

Create a Google Account here. However, just having a Google account does not automatically grant you access to Analytics. First, you must register for Google Analytics, a one-time, simple process.

Upvotes: 0

Related Questions