| // Copyright 2015 The Vanadium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| |
| package io.v.android.apps.reader; |
| |
| import android.app.Application; |
| |
| import com.google.android.gms.analytics.GoogleAnalytics; |
| import com.google.android.gms.analytics.Tracker; |
| |
| /** |
| * This is a subclass of {@link Application} used to provide shared objects for this app, such as |
| * the {@link Tracker}. |
| * |
| * This file is conditionally included to the project, when the "google-services.json" file exists. |
| */ |
| public class ReaderApplication extends Application { |
| private Tracker mTracker; |
| |
| /** |
| * Gets the default {@link Tracker} for this {@link Application}. |
| * |
| * @return tracker |
| */ |
| synchronized public Tracker getDefaultTracker() { |
| if (mTracker == null) { |
| GoogleAnalytics analytics = GoogleAnalytics.getInstance(this); |
| mTracker = analytics.newTracker(R.xml.global_tracker); |
| } |
| |
| return mTracker; |
| } |
| } |