当前位置: 首页>>代码示例>>Java>>正文


Java Tracker.enableAutoActivityTracking方法代码示例

本文整理汇总了Java中com.google.android.gms.analytics.Tracker.enableAutoActivityTracking方法的典型用法代码示例。如果您正苦于以下问题:Java Tracker.enableAutoActivityTracking方法的具体用法?Java Tracker.enableAutoActivityTracking怎么用?Java Tracker.enableAutoActivityTracking使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.analytics.Tracker的用法示例。


在下文中一共展示了Tracker.enableAutoActivityTracking方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: provideAnalyticsManager

import com.google.android.gms.analytics.Tracker; //导入方法依赖的package包/类
@Provides
@Singleton
AnalyticsManager provideAnalyticsManager(GoogleAnalyticsManager googleAnalyticsManager) {

    // set your GA ID Analytics
    String AnalyticsGaId = "YOUR_ANALYTICS_GA_ID";

    if (!TextUtils.isEmpty(AnalyticsGaId)) {
        Tracker tracker = googleAnalyticsManager.getAnalytics().newTracker(AnalyticsGaId);
        tracker.enableAutoActivityTracking(true);
        googleAnalyticsManager.getTrackers().add(tracker);
    }
    return googleAnalyticsManager;
}
 
开发者ID:MobileTribe,项目名称:pandroid,代码行数:15,代码来源:DemoModule.java

示例2: prepareTrackersAndFbLogger

import com.google.android.gms.analytics.Tracker; //导入方法依赖的package包/类
/**
 * Prepare Google analytics trackers and Facebook events logger.
 * Send UTM campaign if exist.
 *
 * @param shop    shop with app specific Google Ua or null, if global tracker is enough.
 * @param context application context.
 */
public static synchronized void prepareTrackersAndFbLogger(Shop shop, Context context) {
    GoogleAnalytics analytics = GoogleAnalytics.getInstance(context);
    // To enable debug logging use: adb shell setprop log.tag.GAv4 DEBUG

    if (shop == null) {
        deleteAppTrackers();
    } else {
        if (!mTrackers.containsKey(TRACKER_APP) && analytics != null) {
            if (shop.getGoogleUa() != null && !shop.getGoogleUa().isEmpty()) {
                Timber.d("Set new app tracker with id: %s", shop.getGoogleUa());
                // App tracker determined by shop
                Tracker appTracker = analytics.newTracker(shop.getGoogleUa());
                appTracker.enableAutoActivityTracking(true);
                appTracker.enableExceptionReporting(false);
                appTracker.enableAdvertisingIdCollection(true);
                mTrackers.put(TRACKER_APP, appTracker);
            } else {
                Timber.e(new RuntimeException(), "Creating GA app tracker with empty Google UA");
            }
        } else {
            Timber.e("Trackers for this app already exist.");
        }
    }

    // Add global tracker only one time.
    if (!mTrackers.containsKey(TRACKER_GLOBAL) && analytics != null) {
        Timber.d("Set new global tracker.");
        // Global app tracker
        Tracker appTrackerGlobal = analytics.newTracker(R.xml.global_tracker);
        appTrackerGlobal.enableAutoActivityTracking(true);
        appTrackerGlobal.enableExceptionReporting(true);
        appTrackerGlobal.enableAdvertisingIdCollection(true);
        mTrackers.put(TRACKER_GLOBAL, appTrackerGlobal);
        // Send camping info only once time.
        sendCampaignInfo();
    }

    facebookLogger = AppEventsLogger.newLogger(MyApplication.getInstance());
}
 
开发者ID:openshopio,项目名称:openshop.io-android,代码行数:47,代码来源:Analytics.java

示例3: onCreate

import com.google.android.gms.analytics.Tracker; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);

    // Fabric init and ErrorHandler.
    Fabric.with(this, new Crashlytics(), new Answers());
    ErrorHandlerProvider.addErrorHandler(new FabricErrorHandler());


    // Google Analytics init and ErrorHandling.
    GoogleAnalytics googleAnalytics = GoogleAnalytics.getInstance(this);
    final Tracker tracker = googleAnalytics.newTracker("UA-72699204-1");

    tracker.enableExceptionReporting(true);
    tracker.enableAdvertisingIdCollection(true);
    tracker.enableAutoActivityTracking(true);

    googleAnalytics.reportActivityStart(this);

    ErrorHandlerProvider.addErrorHandler(new GoogleAnalyticsErrorHandler(tracker));


    this.androidServices = new AndroidServices(this);


    // App config and launch.
    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    config.useCompass = false;
    config.useAccelerometer = true;
    config.hideStatusBar = true;
    config.useWakelock = true;

    initialize(new SpaceTravels3(this.androidServices), config);
}
 
开发者ID:overengineering,项目名称:space-travels-3,代码行数:36,代码来源:AndroidLauncher.java

示例4: onCreate

import com.google.android.gms.analytics.Tracker; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    mActivity = this;
    mVisible = true;
    mContentView = findViewById(R.id.fullscreen_content);

    LogUtils.LOGE("***> firebase uid", PreferencesUtils.getString(mActivity, R.string.key_firebase_uid, ""));
    LogUtils.LOGE("***> is connected", PreferencesUtils.getBoolean(mActivity, R.string.key_is_connected, false) + "");
    if (TextUtils.isEmpty(PreferencesUtils.getString(mActivity, R.string.key_firebase_uid, "")) &&
            !PreferencesUtils.getBoolean(mActivity, R.string.key_is_connected, false)) {
        generateAnonymousAccount();
    }

    if (savedInstanceState != null) {
        mScreenPosition = savedInstanceState.getInt(EXTRA_SCREEN, SCREEN_WELCOME);
    } else {
        BaseApplication application = (BaseApplication) getApplication();
        Tracker tracker = application.getDefaultTracker();
        tracker.enableAutoActivityTracking(true);

        if (PreferencesUtils.getBoolean(mActivity, R.string.key_is_connected, false)) {
            mScreenPosition = SCREEN_SHARE_DISCOVER;
            loadFragment(Constants.Source.MAIN);
        } else {
            mScreenPosition = SCREEN_WELCOME;
            loadFragment(Constants.Source.MAIN);
        }
    }

    // Set up the user interaction to manually show or hide the system UI.
    mContentView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            toggle();
        }
    });
}
 
开发者ID:kyleparker,项目名称:io16experiment-master,代码行数:42,代码来源:MainActivity.java


注:本文中的com.google.android.gms.analytics.Tracker.enableAutoActivityTracking方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。