com.google.android.gms.analytics.Logger Java Examples

The following examples show how to use com.google.android.gms.analytics.Logger. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GoogleAnalyticsManager.java    From barterli_android with Apache License 2.0 6 votes vote down vote up
/**
 * Initialize the tracker
 */
private void initTracker() {

    final Context context = BarterLiApplication.getStaticContext();

    if (!BuildConfig.REPORT_GOOGLE_ANALYTICS) {
        GoogleAnalytics.getInstance(context).setDryRun(true);
        GoogleAnalytics.getInstance(context).getLogger()
                .setLogLevel(Logger.LogLevel.VERBOSE);
    } else {
        GoogleAnalytics.getInstance(context).setDryRun(false);
        GoogleAnalytics.getInstance(context).getLogger()
                .setLogLevel(Logger.LogLevel.ERROR);
    }
    mApplicationTracker = GoogleAnalytics.getInstance(context)
            .newTracker(context.getString(R.string.ga_tracking_id));

    //We will track manually since we use Fragments
    mApplicationTracker.enableAutoActivityTracking(false);
    mApplicationTracker.setSessionTimeout(SESSION_TIMEOUT);

}
 
Example #2
Source File: AnalyticsUtil.java    From IndiaSatelliteWeather with GNU General Public License v2.0 6 votes vote down vote up
public void initializeGATracker() {

        // Set dryRun flag.
        GoogleAnalytics.getInstance(context).setDryRun(GA_IS_DRY_RUN);

        // Set the log level to verbose if dryRun.
        // DEFAULT is set to DRY RUN (only logging will happen)
        GoogleAnalytics.getInstance(context).getLogger()
                .setLogLevel(GA_IS_DRY_RUN ? Logger.LogLevel.VERBOSE : Logger.LogLevel.WARNING);

        // Set the opt out flag when user updates a tracking preference.
        /*
        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
        sp.registerOnSharedPreferenceChangeListener(
                new SharedPreferences.OnSharedPreferenceChangeListener() {
                    @Override
                    public void onSharedPreferenceChanged(SharedPreferences pref, String key) {
                        if (key.equals(TRACKING_PREF_KEY)) {
                            GoogleAnalytics.getInstance(getApplicationContext()).setAppOptOut(
                                    pref.getBoolean(key, false));
                        }
                    }
                });
                */
    }
 
Example #3
Source File: AnalyticsHelper.java    From friendlyping with Apache License 2.0 5 votes vote down vote up
/**
 * Get the default {@link Tracker} for this {@link Application}.
 *
 * @return tracker
 */
public static synchronized Tracker getDefaultTracker(Context context) {
    if (mTracker == null) {
        GoogleAnalytics analytics = GoogleAnalytics
                .getInstance(context.getApplicationContext());
        analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
        mTracker = analytics.newTracker(R.xml.global_tracker);
    }
    return mTracker;
}
 
Example #4
Source File: SyncManager.java    From mini-hacks with MIT License 5 votes vote down vote up
public SyncManager(Context context) {
    this.context = context;

    Manager.enableLogging("CityExplorer", Logger.LogLevel.VERBOSE);
    Manager.enableLogging("Sync", Logger.LogLevel.VERBOSE);

    openDatabase();
}
 
Example #5
Source File: OnesearchApp.java    From Onesearch with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    // Enabling Advertising Features in Google Analytics allows you to take advantage of
    // Remarketing, Demographics & Interests reports, and more.
    Tracker t = getTracker(TrackerName.APP_TRACKER);
    t.enableAdvertisingIdCollection(true);

    if(BuildConfig.DEBUG) {
        GoogleAnalytics.getInstance(this).getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
        GoogleAnalytics.getInstance(this).setDryRun(true);
    }
}