Back to project page Smartlab.
The source code is released under:
Apache License
If you think the Android project Smartlab listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.example.analyticstest; /* ww w.j av a 2s.c o m*/ import android.app.Activity; import android.os.Bundle; import com.google.android.gms.analytics.GoogleAnalytics; import com.google.android.gms.analytics.HitBuilders; import com.google.android.gms.analytics.Tracker; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); GoogleAnalytics analytics = GoogleAnalytics.getInstance(this); Tracker t = analytics.newTracker("UA-43986081-2"); t.send(new HitBuilders.AppViewBuilder().build()); } }