문제

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...

도움이 되었습니까?

해결책

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top