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


Java HitBuilders.EventBuilder方法代码示例

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


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

示例1: buildUserEvent

import com.google.android.gms.analytics.HitBuilders; //导入方法依赖的package包/类
/**
 * Will create an event builder based on the passed variables.
 * @param category - category of event
 * @param action - action of event
 * @param label - label of event
 * @param customDimension1 - custom dimension of event
 * @param customDimension2 - custom dimension of event
 * @return - the created Event Builder for analytics
 */
private static HitBuilders.EventBuilder buildUserEvent(String category, String action, String label,
                                                       @Nullable String customDimension1, @Nullable String customDimension2) {

    HitBuilders.EventBuilder eventBuilder = new HitBuilders.EventBuilder()
            .setCategory(category)
            .setAction(action)
            .setLabel(label)
            .setValue(1);

    // Set custom dimensions
    if (!TextUtils.isEmpty(customDimension1)) {
        eventBuilder.setCustomDimension(1, customDimension1);
    }
    if (!TextUtils.isEmpty(customDimension2)) {
        eventBuilder.setCustomDimension(2, customDimension2);
    }

    return eventBuilder;
}
 
开发者ID:smashingboxes,项目名称:android-analytics,代码行数:29,代码来源:TrackerManager.java

示例2: sendEvent

import com.google.android.gms.analytics.HitBuilders; //导入方法依赖的package包/类
/**
 * Log a specific event under the {@code category}, {@code action}, and {@code label}.
 */
public static void sendEvent(String category, String action, String label, long value,
                             HitBuilders.EventBuilder eventBuilder) {
    if(isInitialized()) {
        mTracker.send(eventBuilder
                .setCategory(category)
                .setAction(action)
                .setLabel(label)
                .setValue(value)
                .build());

        LOGD(TAG, "Event recorded: \n" +
                "\tCategory: " + category +
                "\tAction: " + action +
                "\tLabel: " + label +
                "\tValue: " + value);
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:21,代码来源:AnalyticsHelper.java

示例3: savePreferences

import com.google.android.gms.analytics.HitBuilders; //导入方法依赖的package包/类
private void savePreferences(final String prefKey, final boolean isPositiveResponse) {
    if (mCheckbox != null) {
        final SharedPreferences.Editor editor = mPrefs.prefs.edit();
        final boolean dontShow = mCheckbox.isChecked();
        if (dontShow) {
            Toast.makeText(getActivity(), R.string.pref_dialog_selection_reset_desc, Toast.LENGTH_LONG).show();
            editor.putString(prefKey,
                    getString(isPositiveResponse ? PREFERENCE_ALWAYS_ID : PREFERENCE_NEVER_ID));
        } else {
            editor.putString(prefKey, getString(PREFERENCE_ASK_ID));
        }

        editor.apply();

        HitBuilders.EventBuilder eventBuilder = new HitBuilders.EventBuilder()
                .setCategory(GAUtils.Category.PREFERENCE_DIALOGS)
                .setAction(getArguments().getString(EXTRA_TITLE))
                .setLabel("Response: " + (isPositiveResponse ? "Yes" : "No") + (dontShow ?
                        " (Always)" : " (Just once)"));
        GAUtils.sendEvent(eventBuilder);
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:23,代码来源:SupportYesNoWithPrefsDialog.java

示例4: doTrackEvent

import com.google.android.gms.analytics.HitBuilders; //导入方法依赖的package包/类
private void doTrackEvent(
    String aCategory, String aAction, String aLabel, Long aValue) {

    HitBuilders.EventBuilder hit = new HitBuilders.EventBuilder()
        .setCategory(aCategory)
        .setAction(aAction);

    if (aLabel != null) {
        hit.setLabel(aLabel);
    }

    if (aValue != null) {
        hit.setValue(aValue.longValue());
    }

    mTracker.send(hit.build());
}
 
开发者ID:mozilla-magnet,项目名称:magnet-client,代码行数:18,代码来源:Analytics.java

示例5: savePreferences

import com.google.android.gms.analytics.HitBuilders; //导入方法依赖的package包/类
private void savePreferences(final String prefKey, final boolean isPositiveResponse){
    if(mCheckbox != null) {
        final SharedPreferences.Editor editor = mPrefs.prefs.edit();
        final boolean dontShow = mCheckbox.isChecked();
        if(dontShow){
            Toast.makeText(getActivity(), R.string.pref_dialog_selection_reset_desc, Toast.LENGTH_LONG).show();
                    editor.putString(prefKey,
                            getString(isPositiveResponse ? PREFERENCE_ALWAYS_ID : PREFERENCE_NEVER_ID));
        }
        else{
            editor.putString(prefKey, getString(PREFERENCE_ASK_ID));
        }

        editor.apply();

        HitBuilders.EventBuilder eventBuilder = new HitBuilders.EventBuilder()
                .setCategory(GAUtils.Category.PREFERENCE_DIALOGS)
                .setAction(getArguments().getString(EXTRA_TITLE))
                .setLabel("Response: " + (isPositiveResponse ? "Yes" : "No") + (dontShow ?
                        " (Always)" : " (Just once)"));
        GAUtils.sendEvent(eventBuilder);
    }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:24,代码来源:YesNoWithPrefsDialog.java

示例6: sendEventWithCustomDimension

import com.google.android.gms.analytics.HitBuilders; //导入方法依赖的package包/类
/**
 * Log an specific event under the {@code category}, {@code action}, and {@code label}.  Attach
 * a custom dimension using the provided {@code dimensionIndex} and {@code dimensionValue}
 */
public static void sendEventWithCustomDimension(String category, String action, String label,
                                                int dimensionIndex, String dimensionValue) {
    // Create a new HitBuilder, populate it with the custom dimension, and send it along
    // to the rest of the event building process.
    HitBuilders.EventBuilder eventBuilder = new HitBuilders.EventBuilder();
    eventBuilder.setCustomDimension(dimensionIndex, dimensionValue);
    sendEvent(category, action, label, 0, eventBuilder);

    LOGD(TAG, "Custom Dimension Attached:\n" +
            "\tindex: " + dimensionIndex +
            "\tvalue: " + dimensionValue);
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:17,代码来源:AnalyticsHelper.java

示例7: sendEvent

import com.google.android.gms.analytics.HitBuilders; //导入方法依赖的package包/类
private void sendEvent(final String screenName, final String category, final String action, final HashMap<Integer, String> dimensionsMap) {
    mTracker.setScreenName(screenName);

    HitBuilders.EventBuilder eventBuilder = new HitBuilders.EventBuilder()
            .setCategory(category)
            .setAction(action);

    for (int key : dimensionsMap.keySet()) {
        eventBuilder.setCustomDimension(key, dimensionsMap.get(key));
    }

    mTracker.send(eventBuilder.build());
}
 
开发者ID:Samsung,项目名称:microbit,代码行数:14,代码来源:GoogleAnalyticsManager.java

示例8: trackEvent

import com.google.android.gms.analytics.HitBuilders; //导入方法依赖的package包/类
public void trackEvent(String category, String action, @Nullable String label, @Nullable Long value) {
	HitBuilders.EventBuilder builder = new HitBuilders.EventBuilder().setCategory(category).setAction(action);

	if (label != null) {
		builder.setLabel(label);
	}

	if (value != null) {
		builder.setValue(value);
	}

	if (mTracker != null) {
		mTracker.send(builder.build());
	}
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:16,代码来源:UsageTrackingAppCompatActivity.java

示例9: parsePayload

import com.google.android.gms.analytics.HitBuilders; //导入方法依赖的package包/类
private Map<String, String> parsePayload(Map<String, Object> analyticsPayload) {
    HitBuilders.EventBuilder eventBuilder = new HitBuilders.EventBuilder();

    //TODO Should this be protected, or crash in purpose to avoid mistakes on dev side?
    if (analyticsPayload.containsKey(CATEGORY)) {
        eventBuilder.setCategory((String) analyticsPayload.get(CATEGORY));
    }

    if (analyticsPayload.containsKey(ACTION)) {
        eventBuilder.setCategory((String) analyticsPayload.get(ACTION));
    }
    if (analyticsPayload.containsKey(LABEL)) {
        eventBuilder.setLabel((String) analyticsPayload.get(LABEL));
    }

    if (analyticsPayload.containsKey(VALUE)) {
        eventBuilder.setValue((Long) analyticsPayload.get(VALUE));
    }

    if (analyticsPayload.containsKey(PRODUCT)) {
        eventBuilder.addProduct((Product) analyticsPayload.get(PRODUCT));
    }

    if (analyticsPayload.containsKey(PRODUCT_ACTION)) {
        eventBuilder.setProductAction((ProductAction) analyticsPayload.get(PRODUCT_ACTION));
    }

    return eventBuilder.build();
}
 
开发者ID:Mindera,项目名称:skeletoid-googleanalytics,代码行数:30,代码来源:GAAppender.java

示例10: trackGoogleAnalytics

import com.google.android.gms.analytics.HitBuilders; //导入方法依赖的package包/类
private void trackGoogleAnalytics(String category, String action, String label) {
    // Google Analytics
    HitBuilders.EventBuilder gaEventBuilder = new HitBuilders.EventBuilder();

    gaEventBuilder.setCategory(category);
    gaEventBuilder.setAction(action);
    gaEventBuilder.setLabel(label);

    mTracker.send(gaEventBuilder.build());
}
 
开发者ID:sinhaDroid,项目名称:BlogBookApp,代码行数:11,代码来源:BlogBookAnalytics.java

示例11: sendEvent

import com.google.android.gms.analytics.HitBuilders; //导入方法依赖的package包/类
/**
 * Базовый метод для отправки события c параметрами
 *
 * @param
 * @param category категория
 * @param action   действие
 * @param label    пометка о результате действия
 * @param pair
 */
public static void sendEvent(String category, String action, String label, Map<String, String> pair) {
    Tracker tracker = AGApplication.getTracker();
    HitBuilders.EventBuilder eventBuilder = new HitBuilders.EventBuilder();
    eventBuilder.setAction(action)
            .setCategory(category)
            .setLabel(label)
            .setValue(1)
            .setAll(pair);
    tracker.send(eventBuilder.build());
    Log.i("AG_Google_Analytics", "action = " + action + ", category = " + category + ", label = " + label + ", " + getMapLog(pair));
}
 
开发者ID:active-citizen,项目名称:android.java,代码行数:21,代码来源:GoogleStatistics.java

示例12: onReceive

import com.google.android.gms.analytics.HitBuilders; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
	final String action = intent.getAction();
	if (AttributeEvent.AUTOPILOT_FAILSAFE.equals(action)) {
		final HitBuilders.EventBuilder eventBuilder = new HitBuilders.EventBuilder()
				.setCategory(GAUtils.Category.FAILSAFE).setAction("Autopilot warning")
				.setLabel(drone.getState().getFailsafeWarning());
		GAUtils.sendEvent(eventBuilder);
	}
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:11,代码来源:NotificationHandler.java

示例13: recordFileImport

import com.google.android.gms.analytics.HitBuilders; //导入方法依赖的package包/类
private boolean recordFileImport(SQLiteDatabase db, ContentValues importDetails) {
    // First tell Google Analytics
    final String fileName = importDetails.getAsString(FILE_IDENTIFIER);
    HitBuilders.EventBuilder fileImportValues = new HitBuilders.EventBuilder()
            .setAction("FileImport")
            .setCategory("LOCAL")
            .setLabel(fileName)
            .setValue(1)
            .setCustomDimension(1, fileName);
    mTracker.send(fileImportValues.build());

    // Now record the full details locally.
    final long rowId = db.insert(FILE_IMPORT, null, importDetails);
    return (rowId != -1);
}
 
开发者ID:julianharty,项目名称:app-store-reviews-app,代码行数:16,代码来源:LoadReviewsActivity.java

示例14: reportEvent

import com.google.android.gms.analytics.HitBuilders; //导入方法依赖的package包/类
public void reportEvent(Tracking.Events event, String label) {
    HitBuilders.EventBuilder eventBuilder = new HitBuilders.EventBuilder()
            .setCategory(context.getString(event.category))
            .setAction(context.getString(event.action));
    if (!Strings.isNullOrEmpty(label)) {
        eventBuilder.setLabel(label);
    }
    tracker.send(eventBuilder.build());
}
 
开发者ID:andyCano,项目名称:TaskApp,代码行数:10,代码来源:Tracker.java

示例15: onAutopilotError

import com.google.android.gms.analytics.HitBuilders; //导入方法依赖的package包/类
public void onAutopilotError(String errorName) {
    final ErrorType errorType = ErrorType.getErrorById(errorName);
    if (errorType != null && ErrorType.NO_ERROR != errorType) {
        final HitBuilders.EventBuilder eventBuilder = new HitBuilders.EventBuilder()
                .setCategory(GAUtils.Category.FAILSAFE)
                .setAction("Autopilot error")
                .setLabel(errorType.getLabel(context).toString());
        GAUtils.sendEvent(eventBuilder);
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:11,代码来源:NotificationHandler.java


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