title: Android Google Analytics EasyTracker
body: <p>I'm trying to use Google Analytics in my Android application with 
  <a href="http://code.google.com/intl/fr-FR/apis/analytics/docs/mobile/android.html" rel="nofollow">Google Configuration</a></p>
  
  <ol>
  <li>Add .jar in my project</li>
  <li><p>Insert this in AndroidManifest</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  </code></pre></li>
  <li><p>Add this in my java file</p>
  
  <p>public class MainActivity extends Activity {</p>
  
  <pre><code>GoogleAnalyticsTracker tracker;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
              tracker = GoogleAnalyticsTracker.getInstance();
              tracker.startNewSession("My-UA–XXXXXXXX", this);
  
  
              setContentView(R.layout.main);
              Button createEventButton = (Button)findViewById(R.id.NewEventButton);
              createEventButton.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                  tracker.trackEvent(
                      "Clicks",  // Category
                      "Button",  // Action
                      "clicked", // Label
                      77);       // Value
                }
              });
  
              setContentView(R.layout.main);
  
              Button createPageButton = (Button)findViewById(R.id.NewPageButton);
              createPageButton.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                  // Add a Custom Variable to this pageview, with name of "Medium" and value "MobileApp" and
                  // scope of session-level.
                  tracker.setCustomVar(1, "Navigation Type", "Button click", 2);
                  // Track a page view. This is probably the best way to track which parts of your application
                  // are being used.
                  // E.g.
                  // tracker.trackPageView("/help"); to track someone looking at the help screen.
                  // tracker.trackPageView("/level2"); to track someone reaching level 2 in a game.
                  // tracker.trackPageView("/uploadScreen"); to track someone using an upload screen.
                  tracker.trackPageView("/testApplicationHomeScreen");
                }
              });
  
              Button quitButton = (Button)findViewById(R.id.QuitButton);
              quitButton.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                  finish();
                }
              });
  
              Button dispatchButton = (Button)findViewById(R.id.DispatchButton);
              dispatchButton.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                  // Manually start a dispatch, not needed if the tracker was started with a dispatch
                  // interval.
                  tracker.dispatch();
                }
              });
  
  
  
  
  }
  
  @Override
  protected void onDestroy() {
    super.onDestroy();
    // Stop the tracker when it is no longer needed.
    tracker.stopSession();
  }
  }
  </code></pre></li>
  </ol>
  
  <p>==> And it's ok, no error, compiling and executing but i have created my ua account yesterday (more 24h) and i have nothing in my google analytics panel.</p>
  
  <p>My Question : is there an error in my code or i want to wait again ? Live trafic works for Android application (like tradicional website) ???
  I have no information about Live trafic (when i play my app, i would like to show the number of person using my application) and Saved trafic (with viewed pages, time)</p>
  
  <p>Thank you for your replies and excuse my poor english :)</p>
  
  <p>bye</p>
  
  <hr>
  
  <p><strong>UPDATE 1 :</strong> 
  i've used this tuto : <a href="http://www.xatik.com/2012/03/27/how-to-use-google-analytics-in-android-applications/" rel="nofollow">http://www.xatik.com/2012/03/27/how-to-use-google-analytics-in-android-applications/</a> and i've got this in my Logcat : </p>
  
  <pre><code>04-07 14:21:59.669: INFO/GoogleAnalyticsTracker(864): Host: www.google-analytics.com
  04-07 14:21:59.669: INFO/GoogleAnalyticsTracker(864): User-Agent: GoogleAnalytics/1.4.2 (Linux; U; Android 2.2; en-us; sdk Build/FRF91)
  04-07 14:21:59.669: INFO/GoogleAnalyticsTracker(864): GET /__utm.gif?utmwv=4.8.1ma&amp;utmn=235327630&amp;utme=8(1!Navigation%20Type)9(1!Button%20click)11(1!2)&amp;utmcs=UTF-8&amp;utmsr=240x320&amp;utmul=en-US&amp;utmp=%2FtestApplicationHomeScreen&amp;utmac=BLIBLUBLIBLO–1&amp;utmcc=more_and_more
  </code></pre>
  
  <p>in progress but nothing in my Live Analytics panel....
  i've added EasyTracker .jar in my project
  Here my Activity Code:</p>
  
  <pre><code>import com.google.android.apps.analytics.GoogleAnalyticsTracker;
  import com.google.android.apps.analytics.easytracking.EasyTracker;
  import com.google.android.apps.analytics.easytracking.TrackedActivity;
  
  import android.os.Bundle;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  
  public class MainActivity extends TrackedActivity {
  
      GoogleAnalyticsTracker tracker;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
                  setContentView(R.layout.main);
  
                  Button quitButton = (Button)findViewById(R.id.QuitButton);
                  quitButton.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                          EasyTracker.getTracker().trackEvent("ButtonClick", "MyButtonName", "", 0);
                    }
                  });
      }
  
      @Override
      protected void onDestroy() {
        super.onDestroy();
        //How can i stop the tracking onDestroy ???
      }
  
  }
  </code></pre>