當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。