analytics

This commit is contained in:
danijoo
2016-01-09 02:31:48 +01:00
parent cd3bc60759
commit 2db65c947a
16 changed files with 176 additions and 3 deletions

View File

@@ -1,12 +1,35 @@
package net.headlezz.notificationlogger;
import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.Tracker;
import timber.log.Timber;
public class Application extends android.app.Application {
public static Application singleton;
private Tracker mTracker;
@Override
public void onCreate() {
super.onCreate();
singleton = this;
Timber.plant(new Timber.DebugTree());
}
/**
* Gets the default {@link Tracker} for this {@link Application}.
* @return tracker
*/
synchronized public Tracker getDefaultTracker() {
if (mTracker == null) {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
if(BuildConfig.DEBUG)
analytics.setDryRun(true);
// To enable debug logging use: adb shell setprop log.tag.GAv4 DEBUG
mTracker = analytics.newTracker(R.xml.global_tracker);
}
return mTracker;
}
}