开发者

Google Analytics SDK for Android Code Implementation

开发者 https://www.devze.com 2023-04-03 13:00 出处:网络
Good day I have manage to create my small and simple application, work with screens and layouts but I cannot 开发者_如何学编程make work the Google analytics.

Good day I have manage to create my small and simple application, work with screens and layouts but I cannot 开发者_如何学编程make work the Google analytics.

I think my problems are regarding the code placement, please take a look and tell me where I am wrong.

First I have add and build the path for libGoogleAnalytics.jar

at manifest,

</activity>

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

</manifest>

at package,

package com.av0001;

import com.google.android.apps.analytics.GoogleAnalyticsTracker;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

public class Av0001 extends Activity {
    /** Called when the activity is first created. */
    GoogleAnalyticsTracker tracker;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        tracker = GoogleAnalyticsTracker.getInstance();
        tracker.startNewSession("UA-25516864-1", this);
        setContentView(R.layout.main);
        }
public void myonclick1(View view) {
    Intent mIntent = new Intent(this,Check2.class);
    startActivity(mIntent);
    Toast.makeText(
            this,
            "Thank you for using, enjoy browsing :)", Toast.LENGTH_LONG).show();
    finish();  
}
@Override
protected void onDestroy() {
    super.onDestroy();
    tracker.stopSession();
}
}

So I am stack here, it's running for three days almost,I have no reports at all.

Thanks for support


You setup a session but did you call trackEvent? I am thinking you are missing that. Another thing to test is setup fiddler tracing and see if anything goes to the Analytics endpoint.

HTH

0

精彩评论

暂无评论...
验证码 换一张
取 消