Android Open Source - grtransit G R T Application






From Project

Back to project page grtransit.

License

The source code is released under:

GNU General Public License

If you think the Android project grtransit listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Copyright 2011 Giles Malet./*from   www .  ja  va 2s . c  o m*/
 *
 * This file is part of GRTransit.
 * 
 * GRTransit is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * GRTransit is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with GRTransit.  If not, see <http://www.gnu.org/licenses/>.
 */

package net.kw.shrdlu.grtgtfs;

import android.content.Context;
import android.os.StrictMode;

import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.HitBuilders;
import com.google.android.gms.analytics.Tracker;

public class GRTApplication extends android.app.Application {
  public static final String TAG = "GRTApplication";

  public static Tracker tracker = null;
  public static Preferences mPreferences = null;
    public final static boolean isDebugBuild = BuildConfig.DEBUG;
    public final static String LocalClassNameHome = "Activities.FavstopsActivity";

    @Override
  public void onCreate() {
    super.onCreate();
    // Log.d(TAG, "onCreate");

        Context context = this;

    // Do this before instantiating Globals, as that may do something we'd like
    // to see by having StrictMode on already.
    if (isDebugBuild) {
            StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                    .detectNetwork()
                    .build());
            // .detectDiskReads() -- too noisy
            // .detectDiskWrites() -- too noisy
//            StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
//                    .detectLeakedSqlLiteObjects()
//                    .detectActivityLeaks()
//                    .penaltyLog().penaltyDeath().build());
                    //.detectLeakedClosableObjects()
    }

    mPreferences = new Preferences(context);
        DatabaseHelper dbHelper = new DatabaseHelper(context);

        GoogleAnalytics analytics = GoogleAnalytics.getInstance(context);
        analytics.enableAutoActivityReports(this);
    tracker = analytics.newTracker(getString(R.string.ga_api_key));
        tracker.enableAutoActivityTracking(true);   // need this here and in the parent?
        tracker.setClientId(GRTApplication.mPreferences.getUUID());
    if (isDebugBuild) {
      analytics.setDryRun(true);
    } else {
      analytics.setDryRun(false);
    }

        // Report version details (not reported if analytics DryRun is set).
        String v = "Version " + BuildConfig.VERSION_NAME + " " + BuildConfig.BUILD_TYPE;
        v += ", Db " + DatabaseHelper.GetDBVersion();
        tracker.send(new HitBuilders.EventBuilder()
                .setCategory("Startup")
                .setAction(GRTApplication.mPreferences.getUUID())
                .setLabel(v)
                .build());
  }
}




Java Source Code List

net.kw.shrdlu.grtgtfs.DatabaseHelper.java
net.kw.shrdlu.grtgtfs.GRTApplication.java
net.kw.shrdlu.grtgtfs.NavOptions.java
net.kw.shrdlu.grtgtfs.NotificationCallback.java
net.kw.shrdlu.grtgtfs.Preferences.java
net.kw.shrdlu.grtgtfs.RouteOverlay.java
net.kw.shrdlu.grtgtfs.ServiceCalendar.java
net.kw.shrdlu.grtgtfs.StopsOverlay.java
net.kw.shrdlu.grtgtfs.Activities.ClosestStopsActivity.java
net.kw.shrdlu.grtgtfs.Activities.FavstopsActivity.java
net.kw.shrdlu.grtgtfs.Activities.MenuListActivity.java
net.kw.shrdlu.grtgtfs.Activities.MenuMapActivity.java
net.kw.shrdlu.grtgtfs.Activities.PrefsActivity.java
net.kw.shrdlu.grtgtfs.Activities.RiderAlertsActivity.java
net.kw.shrdlu.grtgtfs.Activities.RouteActivity.java
net.kw.shrdlu.grtgtfs.Activities.RouteselectActivity.java
net.kw.shrdlu.grtgtfs.Activities.SearchActivity.java
net.kw.shrdlu.grtgtfs.Activities.StartupActivity.java
net.kw.shrdlu.grtgtfs.Activities.StopsActivity.java
net.kw.shrdlu.grtgtfs.Activities.TimesActivity.java
net.kw.shrdlu.grtgtfs.Activities.TripStopsActivity.java
net.kw.shrdlu.grtgtfs.LayoutAdapters.FavstopsArrayAdapter.java
net.kw.shrdlu.grtgtfs.LayoutAdapters.ListArrayAdapter.java
net.kw.shrdlu.grtgtfs.LayoutAdapters.ListCursorAdapter.java
net.kw.shrdlu.grtgtfs.LayoutAdapters.NavDrawerItem.java
net.kw.shrdlu.grtgtfs.LayoutAdapters.NavDrawerListAdapter.java
net.kw.shrdlu.grtgtfs.LayoutAdapters.TimeStopdescArrayAdapter.java
net.kw.shrdlu.grtgtfs.LayoutAdapters.TimesArrayAdapter.java