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


Java Tracker.enableAdvertisingIdCollection方法代码示例

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


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

示例1: get

import com.google.android.gms.analytics.Tracker; //导入方法依赖的package包/类
public synchronized Tracker get(Target target) {
    if (!mTrackers.containsKey(target)) {
        Tracker tracker;
        switch (target) {
            case APP:
                tracker = GoogleAnalytics.getInstance(mContext).newTracker(R.xml.app_tracker);
                tracker.enableAdvertisingIdCollection(true);
                break;

            default:
                throw new IllegalArgumentException("Unhandled analytics target " + target);
        }
        mTrackers.put(target, tracker);
    }

    return mTrackers.get(target);
}
 
开发者ID:LesterLyu,项目名称:UofT-Timetable,代码行数:18,代码来源:AnalyticsTrackers.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: provideGoogleAnalyticsTracker

import com.google.android.gms.analytics.Tracker; //导入方法依赖的package包/类
@Singleton
@Provides
public Tracker provideGoogleAnalyticsTracker(Context context) {
    GoogleAnalytics ga = GoogleAnalytics.getInstance(context);
    Tracker tracker = ga.newTracker(BuildConfig.GA_TRACKING_ID);
    tracker.enableAdvertisingIdCollection(true);
    tracker.enableExceptionReporting(true);
    return tracker;
}
 
开发者ID:konifar,项目名称:droidkaigi2016,代码行数:10,代码来源:AppModule.java


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