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


Java Tracker类代码示例

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


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

示例1: onViewCreated

import com.google.android.gms.analytics.Tracker; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    listView = (RecyclerView)view.findViewById(android.R.id.list);
    listView.setLayoutManager(new LinearLayoutManager(getActivity()));
    listView.setItemAnimator(new DefaultItemAnimator());
    listView.setAdapter(adapter);

    view.findViewById(R.id.fabNewPlaylist).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            newPlaylist();
        }
    });

    Tracker t = ((NavigationActivity)getActivity()).getTracker(NavigationActivity.TrackerName.APP_TRACKER);
    t.setScreenName("List of playlists");
    t.send(new HitBuilders.AppViewBuilder().build());
}
 
开发者ID:dmllr,项目名称:IdealMedia,代码行数:21,代码来源:PlaylistsFragment.java

示例2: init

import com.google.android.gms.analytics.Tracker; //导入依赖的package包/类
public void init(BaseActivity activity){
    baseActivity = activity;
    activityStack.push(activity);
    sh = new SharedHelper(activity.getApplicationContext());
    loadingDialog = new LoadingDialog(activity);
    loadingDialog.setOnCancelListener((dialogInterface -> canceled = true));
    String screenName = activity.getClass().getSimpleName();
    activityMap.put(screenName  + System.currentTimeMillis(), activity);
    if (SStaticR.ANALYTICS_ON){
        // Obtain the shared Tracker instance.
        LIVE application = (LIVE)baseActivity.getApplication();
        Tracker mTracker = application.getDefaultTracker();
        mTracker.setScreenName(screenName);
        mTracker.send(new HitBuilders.ScreenViewBuilder().build());
    }
}
 
开发者ID:Lazyeraser,项目名称:DereHelper,代码行数:17,代码来源:Base.java

示例3: onCreateView

import com.google.android.gms.analytics.Tracker; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View v = inflater.inflate(R.layout.fragment_podcast, container, false);

    mActivity = (Home) getActivity();
    mContext = getContext();

    podcastList = (ListView) v.findViewById(R.id.podcastlist);
    noElements = (TextView) v.findViewById(R.id.no_elements);

    avi = (AVLoadingIndicatorView) v.findViewById(R.id.avi);
    avi.show();

    // Get Programs
    new GetPrograms(mContext, this).execute();

    App application = (App) getActivity().getApplication();
    Tracker mTracker = application.getDefaultTracker();
    mTracker.setScreenName(getString(R.string.podcast_view));
    mTracker.send(new HitBuilders.ScreenViewBuilder().build());

    return v;
}
 
开发者ID:ficiverson,项目名称:radiocom-android,代码行数:25,代码来源:PodcastPageFragment.java

示例4: onCreateView

import com.google.android.gms.analytics.Tracker; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View v = inflater.inflate(R.layout.fragment_transmissions, container, false);

    mActivity = (Home) getActivity();
    mContext = getContext();

    transmissionList = (ListView) v.findViewById(R.id.transmissionsList);
    noElements = (TextView) v.findViewById(R.id.no_elements);

    avi = (AVLoadingIndicatorView) v.findViewById(R.id.avi);
    avi.show();

    // Get Transmissions
    new GetTransmissions(mContext, this, getArguments().getString(KEY_DAY)).execute();

    App application = (App) getActivity().getApplication();
    Tracker mTracker = application.getDefaultTracker();
    mTracker.setScreenName(getString(R.string.transmisions_view));
    mTracker.send(new HitBuilders.ScreenViewBuilder().build());

    return v;
}
 
开发者ID:ficiverson,项目名称:radiocom-android,代码行数:25,代码来源:LiveBroadcastPageFragment.java

示例5: onCreate

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

    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);

    mContext = this;
    mActivity = this;

    avi = (AVLoadingIndicatorView) findViewById(R.id.avi);
    avi.show();

    snackView = (View) findViewById(R.id.snackView);

    launchGetStations(mContext, mActivity);

    App application = (App) getApplication();
    Tracker mTracker = application.getDefaultTracker();
    mTracker.setScreenName(getString(R.string.splash_activity));
    mTracker.send(new HitBuilders.ScreenViewBuilder().build());

}
 
开发者ID:ficiverson,项目名称:radiocom-android,代码行数:25,代码来源:Splash.java

示例6: getTracker

import com.google.android.gms.analytics.Tracker; //导入依赖的package包/类
/**
 * Gets the google analytics tracker.
 *
 * @return the google analytics tracker.
 */
private Tracker getTracker() {
    if (mTracker == null) {

        int checkExistence = mContext.getResources().getIdentifier("global_tracker", "xml", mContext.getPackageName());

        if (checkExistence == 0) {
            Log.e(AnalyticsManager.class.getCanonicalName(), "Please check if you have global-services.json");
        } else {
            mTracker = GoogleAnalytics.getInstance(mContext).newTracker(checkExistence);
            mTracker.enableAutoActivityTracking(false);
            mTracker.enableAdvertisingIdCollection(false);
            mTracker.enableExceptionReporting(false);
        }
    }
    return mTracker;
}
 
开发者ID:massivedisaster,项目名称:ADAL,代码行数:22,代码来源:AnalyticsManager.java

示例7: 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

示例8: setup

import com.google.android.gms.analytics.Tracker; //导入依赖的package包/类
@Before
public void setup()
{
	// Mock behavior for when Tracker.send(Map<String, String>) is called
	tracker = mock(Tracker.class);
	doAnswer(new Answer<Void>()
	{
		public Void answer(InvocationOnMock invocation)
		{
			Object[] args = invocation.getArguments();
			//noinspection unchecked
			testEventPropertiesMap = (Map<String, String>) args[0];
			sendCalled = true;
			return null;
		}
	}).when(tracker).send(anyMapOf(String.class, String.class));

	provider = new GoogleAnalyticsProvider(tracker);

	sendCalled = false;
	testEventPropertiesMap = null;
}
 
开发者ID:busybusy,项目名称:AnalyticsKit-Android,代码行数:23,代码来源:GoogleAnalyticsProviderTest.java

示例9: deleteAppTrackersTest

import com.google.android.gms.analytics.Tracker; //导入依赖的package包/类
@Test
public void deleteAppTrackersTest() throws Exception {
    prepareMockedFields();
    Analytics.prepareTrackersAndFbLogger(testShop, mockContext);

    // Check size before deletion
    HashMap<String, Tracker> trackersField = Whitebox.getInternalState(Analytics.class, "mTrackers");
    assertEquals(trackersField.size(), 2);

    // Tested method invocation
    Analytics.deleteAppTrackers();

    // Verify final size
    trackersField = Whitebox.getInternalState(Analytics.class, "mTrackers");
    assertEquals(trackersField.size(), 1);
}
 
开发者ID:openshopio,项目名称:openshop.io-android,代码行数:17,代码来源:AnalyticsUnitTest.java

示例10: sendEvent

import com.google.android.gms.analytics.Tracker; //导入依赖的package包/类
public static void sendEvent(Tracker tracker, String category, String action, String label) {
    if (tracker == null)
        return;
    
    if (category == null || category.isEmpty())
        category = Utils.ANALYTICS_CATEGORY_ACTION;
    
    HitBuilders.EventBuilder analyticsEvent = new HitBuilders.EventBuilder()
            .setCategory(category)
            .setAction(action);
    
    if (label != null && !label.isEmpty())
        analyticsEvent.setLabel(label);
    
    tracker.send(analyticsEvent.build());
}
 
开发者ID:adityabhaskar,项目名称:DoneForAndroid,代码行数:17,代码来源:Utils.java

示例11: getDefaultTracker

import com.google.android.gms.analytics.Tracker; //导入依赖的package包/类
synchronized public Tracker getDefaultTracker() {
    if (mTracker == null) {
        GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
        // Чтобы включить ведение журнала отладки, используйте adb shell setprop log.tag.GAv4 DEBUG
        mTracker = analytics.newTracker("global_tracker");
    }
    return mTracker;
}
 
开发者ID:Ramotion,项目名称:showroom-android,代码行数:9,代码来源:ShowroomApplication.java

示例12: 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);
                break;
            default:
                throw new IllegalArgumentException("Unhandled analytics target " + target);
        }
        mTrackers.put(target, tracker);
    }

    return mTrackers.get(target);
}
 
开发者ID:MuditSrivastava,项目名称:Canvas-Vision,代码行数:16,代码来源:AnalyticsTrackers.java

示例13: trackException

import com.google.android.gms.analytics.Tracker; //导入依赖的package包/类
public void trackException(Exception e) {
    if (e != null) {
        Tracker t = getGoogleAnalyticsTracker();

        t.send(new HitBuilders.ExceptionBuilder()
                .setDescription(
                        new StandardExceptionParser(this, null)
                                .getDescription(Thread.currentThread().getName(), e))
                .setFatal(false)
                .build()
        );
    }
}
 
开发者ID:MuditSrivastava,项目名称:Canvas-Vision,代码行数:14,代码来源:MyApplication.java

示例14: getGATracker

import com.google.android.gms.analytics.Tracker; //导入依赖的package包/类
synchronized static Tracker getGATracker(Context context) {
    if (tracker == null) {
        GoogleAnalytics analytics = GoogleAnalytics.getInstance(context);
        tracker = analytics.newTracker(R.xml.ga_app_tracker);
    }
    return tracker;
}
 
开发者ID:njitdev,项目名称:sa-android,代码行数:8,代码来源:SAGlobal.java

示例15: getDefaultTracker

import com.google.android.gms.analytics.Tracker; //导入依赖的package包/类
synchronized public Tracker getDefaultTracker() {
    if (mTracker == null) {
        GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
        // To enable debug logging use: adb shell setprop log.tag.GAv4 DEBUG
        mTracker = analytics.newTracker(R.xml.app_tracker);
    }
    return mTracker;
}
 
开发者ID:PaulKlinger,项目名称:Sprog-App,代码行数:9,代码来源:SprogApplication.java


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