Java 类com.google.android.gms.analytics.HitBuilders 实例源码

项目:android-analytics    文件:TrackerManager.java   
/**
 * 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;
}
项目:IdealMedia    文件:NavigationDrawerFragment.java   
private void sendSupportMail() {
    final Intent intent = new Intent(Intent.ACTION_SENDTO);

    intent.setType("message/rfc822");
    intent.setData(Uri.parse(String.format("mailto:%s?subject=%s", getString(R.string.support_email), Uri.encode(getString(R.string.app_name)))));
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

    try {
        startActivity(intent);

        ((NavigationActivity)getActivity()).getTracker(NavigationActivity.TrackerName.APP_TRACKER)
                .send(new HitBuilders.EventBuilder().setCategory("Support").setAction("Send").setLabel("Yes").build());
    } catch (android.content.ActivityNotFoundException ex) {
        Toast.makeText(getActivity(), getString(R.string.no_email_client), Toast.LENGTH_SHORT).show();
        ((NavigationActivity)getActivity()).getTracker(NavigationActivity.TrackerName.APP_TRACKER)
                .send(new HitBuilders.EventBuilder().setCategory("Support").setAction("Send").setLabel("Error").build());
    }
}
项目:IdealMedia    文件:NavigationDrawerFragment.java   
private void shareVK() {
    if (VKSdk.isLoggedIn() || VKSdk.wakeUpSession()) {
        new VKShareDialog()
                .setText(getString(R.string.like_text))
                .setAttachmentLink(getString(R.string.like_url_title), getString(R.string.like_url))
                .setShareDialogListener(new VKShareDialog.VKShareDialogListener() {
                    @Override
                    public void onVkShareComplete(int i) {
                        showThankYouToast();

                        ((NavigationActivity)getActivity()).getTracker(NavigationActivity.TrackerName.APP_TRACKER)
                                .send(new HitBuilders.EventBuilder().setCategory("Sharing").setAction("VK").setLabel("OK").build());
                    }

                    @Override
                    public void onVkShareCancel() {
                        ((NavigationActivity)getActivity()).getTracker(NavigationActivity.TrackerName.APP_TRACKER)
                                .send(new HitBuilders.EventBuilder().setCategory("Sharing").setAction("VK").setLabel("Cancel").build());
                    }
                })
                .show(getFragmentManager(), "SHARE");

    } else
        VKSdk.authorize(NavigationActivity.vkScope, true, false);
}
项目:IdealMedia    文件:NavigationDrawerFragment.java   
@SuppressLint("SetJavaScriptEnabled")
private void shareTwitter() {
    Intent twitterIntent = new Intent();
    twitterIntent.setType("text/plain");
    twitterIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.like_text));

    final PackageManager packageManager = getActivity().getPackageManager();
    List<ResolveInfo> list = packageManager.queryIntentActivities(twitterIntent, PackageManager.MATCH_DEFAULT_ONLY);

    boolean found = false;
    for (ResolveInfo resolveInfo : list) {
        String p = resolveInfo.activityInfo.packageName;
        if (p != null && p.startsWith("com.twitter.android")) {
            found = true;
            twitterIntent.setPackage(p);
            startActivity(twitterIntent);

            ((NavigationActivity)getActivity()).getTracker(NavigationActivity.TrackerName.APP_TRACKER)
                    .send(new HitBuilders.EventBuilder().setCategory("Sharing").setAction("Twitter").setLabel("App").build());
        }
    }

    if (!found) {
        ProgressDialog progressDialog = new ProgressDialog(getActivity());

        TwitterShare d = new TwitterShare(
                getActivity(), progressDialog,
                "http://twitter.com/share?text=" + Uri.encode(getString(R.string.like_text_twitter)) + "&url=" + Uri.parse(getString(R.string.like_url)));
        d.show();

        progressDialog.setMessage(getString(R.string.text_loading));
        progressDialog.setCancelable(true);
        progressDialog.show();

        ((NavigationActivity)getActivity()).getTracker(NavigationActivity.TrackerName.APP_TRACKER)
                .send(new HitBuilders.EventBuilder().setCategory("Sharing").setAction("Twitter").setLabel("Web").build());
    }
}
项目:IdealMedia    文件:PlaylistsFragment.java   
@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());
}
项目:IdealMedia    文件:NavigationActivity.java   
private void setTheme() {
    int themeIndex = PreferenceManager.getDefaultSharedPreferences(this).getInt(getString(R.string.key_theme), 0);
    int theme = R.style.Theme_IdealMedia_Colored;

    switch (themeIndex) {
        case 0:
            theme = R.style.Theme_IdealMedia_Colored;
            break;
        case 1:
            theme = R.style.Theme_IdealMedia_Colored_Dark;
            break;
        case 2:
            theme = R.style.Theme_IdealMedia_Dark;
            break;
    }

    setTheme(theme);

    getTracker(NavigationActivity.TrackerName.APP_TRACKER)
            .send(new HitBuilders.EventBuilder().setCategory("UX").setAction("theme").setLabel("index " + themeIndex).build());
}
项目:iosched-reader    文件:AnalyticsHelper.java   
/**
 * 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);
    }
}
项目:CustomAndroidOneSheeld    文件:ShieldFragmentParent.java   
@Override
    public void onResume() {
        super.onResume();
//        if (getApplication().getAppFirmata().isOpen() == false && !getApplication().getIsDemoMode()) return;
        if (getApplication().getRunningShields().get(getControllerTag()) == null) {
            if (!reInitController())
                return;
        }
        if (activity == null || activity.findViewById(R.id.shieldStatus) == null)
            return;
        MainActivity.currentShieldTag = getControllerTag();
        // restore the staus of shield interaction toggle button
        if (getApplication().getRunningShields().get(getControllerTag()) != null)
            ((ToggleButton) activity.findViewById(R.id.shieldStatus))
                    .setChecked(getApplication().getRunningShields().get(
                            getControllerTag()).isInteractive);
        // Google analytics tracking
        getApplication().getTracker().setScreenName(getControllerTag());
        getApplication().getTracker().send(
                new HitBuilders.ScreenViewBuilder().build());
        // Logging current view for crashlytics
        CrashlyticsUtils.setString("Current View", getTag());
        ((T) this).doOnResume();
    }
项目:FicsaveMiddleware    文件:FicsaveWebViewClient.java   
@Override
@SuppressWarnings("deprecation")
public boolean shouldOverrideUrlLoading(WebView view, String url) {

    // if URL's host is ficsave.xyz, open in webview, else let android open it somewhere else
    if (Uri.parse(url).getHost().equals(mActivity.getString(R.string.ficsave_host))) {
        return false;
    }

    mGTracker.send(new HitBuilders.EventBuilder()
            .setCategory("WebViewClientCategory")
            .setAction("Other Url than ficsave Opened")
            .setLabel(URL_LABEL + url)
            .setValue(1)
            .build());
    Bundle bundle = new Bundle();
    bundle.putString("Url", url);
    mFTracker.logEvent("OtherUrlthanficsaveOpened", bundle);

    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    mActivity.startActivity(intent);

    return true;
}
项目:FicsaveMiddleware    文件:MainActivity.java   
private String getIntentViewUrl() {
    String url = "";
    Intent intent = getIntent();
    String intentAction = intent.getAction();
    if (Intent.ACTION_VIEW.equals(intentAction)) {
        url = intent.getData().toString();
        Log.d("ficsaveM/deepLink", url + " " + intent.toString());

        mGTracker.send(new HitBuilders.EventBuilder()
                .setCategory(MAIN_PAGE_CATEGORY)
                .setAction("Deep Link Accessed")
                .setLabel(URL_LABEL + url)
                .setValue(1)
                .build());
        Bundle bundle = new Bundle();
        bundle.putString("Url", url);
        mFTracker.logEvent("DeepLinkAccessed", bundle);
    }
    return url;
}
项目:FicsaveMiddleware    文件:MainActivity.java   
private void setIntentFicUrl() {
    ficUrl = "";
    Intent intent = getIntent();
    if (intent != null) {
        String intentType = intent.getType();
        String intentAction = intent.getAction();
        Log.d("ficsaveM/intentReceived", intentAction + " " + intent.toString());
        if (Intent.ACTION_SEND.equals(intentAction) && intentType != null && "text/plain".equals(intentType)) {
            Matcher m = Patterns.WEB_URL.matcher(intent.getStringExtra(Intent.EXTRA_TEXT));
            while (m.find()) {
                String url = m.group();
                ficUrl = url;
                Log.d("ficsaveM/setIntFicUrl", "URL extracted: " + url);

                mGTracker.send(new HitBuilders.EventBuilder()
                        .setCategory(MAIN_PAGE_CATEGORY)
                        .setAction("Fic Url Set")
                        .setLabel(URL_LABEL + ficUrl)
                        .setValue(1)
                        .build());
                Bundle bundle = new Bundle();
                bundle.putString("Url", ficUrl);
                mFTracker.logEvent("FicUrlSet", bundle);
            }

        }
    }
}
项目:DereHelper    文件:Base.java   
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());
    }
}
项目:AnalyticsKit-Android    文件:GoogleAnalyticsProvider.java   
/**
 * @see AnalyticsKitProvider
 */
@Override
public void endTimedEvent(@NonNull AnalyticsEvent timedEvent) throws IllegalStateException
{
    ensureTimeTrackingMaps();

    long           endTime       = System.currentTimeMillis();
    Long           startTime     = this.eventTimes.remove(timedEvent.name());
    AnalyticsEvent finishedEvent = this.timedEvents.remove(timedEvent.name());

    if (startTime != null && finishedEvent != null)
    {
        HitBuilders.TimingBuilder timingBuilder = new HitBuilders.TimingBuilder();
        timingBuilder.setLabel(finishedEvent.name())
                     .setCategory("Timed Events")
                     .setValue(endTime - startTime);
        // add any custom attributes already set on the event
        timingBuilder.setAll(stringifyAttributesMap(finishedEvent.getAttributes()));
        this.tracker.send(timingBuilder.build());
    }
    else
    {
        throw new IllegalStateException("Attempted ending an event that was never started (or was previously ended): " + timedEvent.name());
    }
}
项目:pandroid    文件:GoogleAnalyticsManager.java   
private <T> T addDimensions(T builder, HashMap<String, Object> params) {
    for (Map.Entry<String, Object> entry : params.entrySet()) {
        try {
            int dimensionInteger = Integer.parseInt(entry.getKey());
            if (entry.getValue() instanceof String) {
                if (builder instanceof HitBuilders.EventBuilder) {
                    ((HitBuilders.EventBuilder) builder).setCustomDimension(dimensionInteger, (String) entry.getValue());
                } else if (builder instanceof HitBuilders.TimingBuilder) {
                    ((HitBuilders.TimingBuilder) builder).setCustomDimension(dimensionInteger, (String) entry.getValue());
                } else if (builder instanceof HitBuilders.ScreenViewBuilder) {
                    ((HitBuilders.ScreenViewBuilder) builder).setCustomDimension(dimensionInteger, (String) entry.getValue());
                }
            }
        } catch (NumberFormatException ignore) {
        }
    }
    return builder;
}
项目:pandroid    文件:GoogleAnalyticsManager.java   
private <T> T addMetrics(T builder, HashMap<String, Object> params) {
    for (Map.Entry<String, Object> entry : params.entrySet()) {
        try {
            int metricInteger = Integer.parseInt(entry.getKey());
            if (entry.getValue() instanceof Float) {
                if (builder instanceof HitBuilders.EventBuilder) {
                    ((HitBuilders.EventBuilder) builder).setCustomMetric(metricInteger, (Float) entry.getValue());
                } else if (builder instanceof HitBuilders.TimingBuilder) {
                    ((HitBuilders.TimingBuilder) builder).setCustomMetric(metricInteger, (Float) entry.getValue());
                } else if (builder instanceof HitBuilders.ScreenViewBuilder) {
                    ((HitBuilders.ScreenViewBuilder) builder).setCustomMetric(metricInteger, (Float) entry.getValue());
                }
            }
        } catch (NumberFormatException ignore) {
        }

    }
    return builder;
}
项目:droidplanner-master    文件:DroidPlannerService.java   
void disconnectMAVConnection(ConnectionParameter connParams, String listenerTag) {
    final AndroidMavLinkConnection conn = mavConnections.get(connParams);
    if (conn == null)
        return;

    conn.removeMavLinkConnectionListener(listenerTag);

    if (conn.getMavLinkConnectionListenersCount() == 0 && conn.getConnectionStatus() !=
            MavLinkConnection.MAVLINK_DISCONNECTED) {
        Log.d(TAG, "Disconnecting...");
        conn.disconnect();

        GAUtils.sendEvent(new HitBuilders.EventBuilder()
                .setCategory(GAUtils.Category.MAVLINK_CONNECTION)
                .setAction("MavLink disconnect")
                .setLabel(connParams.toString()));
    }
}
项目:2015-Google-I-O-app    文件:AnalyticsHelper.java   
/**
 * 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);
    }
}
项目:openshop.io-android    文件:Analytics.java   
/**
 * Method sends "category view" event to Google Analytics.
 *
 * @param categoryId   id category for logging.
 * @param categoryName category name for logging.
 * @param isSearch     determine if normal category or search category.
 */
public static void logCategoryView(long categoryId, String categoryName, boolean isSearch) {
    Bundle parameters = new Bundle();
    parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_TYPE, "category");

    if (categoryId == 0) {
        Timber.e("Is categoryId = 0.");
    } else {
        parameters.putLong(AppEventsConstants.EVENT_PARAM_CONTENT_ID, categoryId);
        parameters.putString(AppEventsConstants.EVENT_PARAM_DESCRIPTION, categoryName);
        logFbEvent(AppEventsConstants.EVENT_NAME_VIEWED_CONTENT, null, parameters);

        Map<String, String> event = new HitBuilders.EventBuilder()
                .setCategory("VIEW_CATEGORY")
                .setAction(isSearch ? "SEARCH" : "VIEW_CATEGORY")
                .setLabel(isSearch ? "Search: " + categoryName : "CategoryId: " + categoryId + ". CategoryName: " + categoryName)
                .build();

        sendEventToAppTrackers(event);
    }
}
项目:magnet-client    文件:Analytics.java   
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());
}
项目:magnet-client    文件:Analytics.java   
private void doTrackTiming(String aCategory, Double aValue,
    String aName, String aLabel) {

    HitBuilders.TimingBuilder hit = new HitBuilders.TimingBuilder()
        .setCategory(aCategory)
        .setValue(aValue.longValue());

    if (aName != null) {
        hit.setVariable(aName);
    }

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

    mTracker.send(hit.build());
}
项目:smconf-android    文件:AnalyticsHelper.java   
/**
 * 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);
    }
}
项目:openshop.io-android    文件:Analytics.java   
/**
 * Method sends product view event to defined Analytics.
 *
 * @param remoteId remote id of the viewed product.
 * @param name     name of the viewed product.
 */
public static void logProductView(long remoteId, String name) {
    // FB event log
    Bundle parameters = new Bundle();
    parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_TYPE, PRODUCT);
    parameters.putLong(AppEventsConstants.EVENT_PARAM_CONTENT_ID, remoteId);
    parameters.putString(AppEventsConstants.EVENT_PARAM_DESCRIPTION, name);
    logFbEvent(AppEventsConstants.EVENT_NAME_VIEWED_CONTENT, null, parameters);

    // GA event log
    Map<String, String> event = new HitBuilders.EventBuilder()
            .setCategory(PRODUCT)
            .setAction("view")
            .setLabel("product with id: " + remoteId + ", name: " + name)
            .build();
    sendEventToAppTrackers(event);
}
项目:droidplanner-master    文件:DroneshareDialog.java   
static public void perhapsShow(FragmentActivity parent) {
    DroidPlannerPrefs prefs = new DroidPlannerPrefs(parent);

    int numRuns = 10; // Don't pester the user until they have played with the app some...
    if (prefs.getNumberOfRuns() > numRuns
            && prefs.getDroneshareEnabled()
            && (prefs.getDroneshareLogin().isEmpty() || prefs.getDronesharePassword().isEmpty())) {
//      Create an instance of the dialog fragment and show it
        DialogFragment dialog = new DroneshareDialog();
        dialog.show(parent.getSupportFragmentManager(), "DroneshareDialog");

           final HitBuilders.EventBuilder eventBuilder = new HitBuilders.EventBuilder()
                   .setCategory(GAUtils.Category.DRONESHARE)
                   .setAction(DRONESHARE_PROMPT_ACTION)
                   .setLabel("droneshare prompt shown");
           GAUtils.sendEvent(eventBuilder);
       }
}
项目:Centrum.fm    文件:MainActivity.java   
@SuppressWarnings("deprecation")
@TargetApi(21)
@Override
public void shareTextUrl(String url, String description) {
    tracker.send(new HitBuilders.EventBuilder()
            .setCategory("Share")
            .setAction(url)
            .build());

    Intent share = new Intent(android.content.Intent.ACTION_SEND);
    share.setType("text/plain");

    if (Build.VERSION.SDK_INT < 21)
        share.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    else
        share.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);

    // add data to the intent, the receiving app will decide
    // what to do with it.
    share.putExtra(Intent.EXTRA_SUBJECT, description);
    share.putExtra(Intent.EXTRA_TEXT, url);

    startActivity(Intent.createChooser(share, getString(R.string.action_share)));
}
项目:Centrum.fm    文件:StreamService.java   
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
    stopPlayer();
    // try to restart the player
    if (currentUrl != null && Connectivity.isConnected(this)) {
        Log.e("StreamService", "An error occurred, trying to restart the player");
        // report this error to the tracker
        if (reportedErrors < 3) {
            ((MyApplication) getApplication()).getDefaultTracker()
                    .send(new HitBuilders.EventBuilder()
                            .setCategory("Playback error " + what + " " + extra)
                            .setAction("Restart player")
                            .setLabel("error playback")
                            .build());
            reportedErrors++;
        }
        // reinitialize the player
        playUrl(currentUrl);
        foregroundStart();
    }
    return true;
}
项目:Tower-develop    文件:SupportYesNoWithPrefsDialog.java   
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);
    }
}
项目:openshop.io-android    文件:Analytics.java   
/**
 * Method sends "user changed shop" event to defined Analytics.
 *
 * @param actualNonNullShop active shop before change.
 * @param newShopSelected   active shop after change.
 */
public static void logShopChange(Shop actualNonNullShop, Shop newShopSelected) {
    if (actualNonNullShop != null && newShopSelected != null) {
        String description = "From (id=" + actualNonNullShop.getId() + ",name=" + actualNonNullShop.getName() +
                ") to (id=" + newShopSelected.getId() + ",name=" + newShopSelected.getId() + ")";
        // FB facebookLogger
        Bundle parameters = new Bundle();
        parameters.putString(AppEventsConstants.EVENT_PARAM_DESCRIPTION, description);
        logFbEvent(AppEventsConstants.EVENT_NAME_UNLOCKED_ACHIEVEMENT, null, parameters);

        // Ga
        Map<String, String> event = new HitBuilders.EventBuilder()
                .setCategory("CHANGE_SHOP")
                .setAction("CHANGE_SHOP")
                .setLabel(description)
                .build();
        sendEventToAppTrackers(event);
    } else {
        Timber.e(new RuntimeException(), "Try log shop change with null parameters");
    }
}
项目:droidplanner-master    文件:SettingsFragment.java   
private void updateFirmwareVersionPreference(String firmwareVersion) {
    final Preference firmwareVersionPref = findPreference(getString(R.string.pref_firmware_version_key));
    if (firmwareVersionPref != null) {
        final HitBuilders.EventBuilder firmwareEvent = new HitBuilders.EventBuilder()
                .setCategory(GAUtils.Category.MAVLINK_CONNECTION);

        if (firmwareVersion == null) {
            firmwareVersionPref.setSummary(getString(R.string.empty_content));
            firmwareEvent.setAction("Firmware version unset");
        } else {
            firmwareVersionPref.setSummary(firmwareVersion);
            firmwareEvent.setAction("Firmware version set").setLabel(firmwareVersion);
        }

        // Record the firmware version.
        GAUtils.sendEvent(firmwareEvent);
    }
}
项目:app-store-reviews-app    文件:WelcomeActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_welcome);

    // Obtain the shared Tracker instance.
    AnalyticsApplication application = (AnalyticsApplication) getApplication();
    mTracker = application.getDefaultTracker();

    // [START screen_view_hit]
    Log.i(TAG, "Setting screen name: " + TAG);
    mTracker.setScreenName(TAG);
    mTracker.send(new HitBuilders.ScreenViewBuilder().build());
    // [END screen_view_hit]

    numberOfReviews = ReviewsDatabaseHelper.reviewCount(this);
    TextView noReviewsMessage = (TextView) findViewById(R.id.no_reviews_yet);
    if (numberOfReviews == 0) {
        noReviewsMessage.setVisibility(View.VISIBLE);
    } else {
        noReviewsMessage.setVisibility(View.GONE);
    }
}
项目:TowerCollector    文件:GoogleAnalyticsReportingService.java   
@Override
public void sendUploadFinished(long duration, String networkType, AnalyticsStatistics stats) {
    this.tracker.send(new HitBuilders.EventBuilder(Category.Tasks, Action.Upload)
            .setLabel(Label.Finish)
            .setValue(1L)
            .setCustomDimension(Dimension.UploadNetworkType, networkType)
            .setCustomMetric(Metric.StatisticsLocations, stats.getLocations())
            .setCustomMetric(Metric.StatisticsCells, stats.getCells())
            .setCustomMetric(Metric.StatisticsDays, stats.getDays())
            .setCustomMetric(Metric.Duration, duration)
            .build());
    this.tracker.send(new HitBuilders.TimingBuilder(Category.Tasks, Action.Upload, duration)
            .setLabel(Label.Finish)
            .setCustomDimension(Dimension.UploadNetworkType, networkType)
            .build());
}
项目:Canvas-Vision    文件:MyApplication.java   
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()
        );
    }
}
项目:DiscogsBrowser    文件:AnalyticsTracker.java   
public void send(String screenName, String category, String action, String label, String value)
{
    if (!BuildConfig.DEBUG)
    {
        tracker.setScreenName(screenName);
        tracker.send(new HitBuilders.EventBuilder()
                .setCategory(category)
                .setAction(action)
                .setLabel(label)
                .setValue(Long.parseLong(value))
                .build());
    }
}
项目:Ships    文件:Analytics.java   
public synchronized void logEvent(final String category,final String action,final String label){
    validateTracker();

    tracker.send(new HitBuilders.EventBuilder()
           .setCategory(category)
           .setAction(action)
           .setLabel(label)
           .build());
}
项目:Ships    文件:Analytics.java   
public synchronized void logEvent(final String category,final String action,final String label,final long value){
    validateTracker();

    tracker.send(new HitBuilders.EventBuilder()
            .setCategory(category)
            .setAction(action)
            .setLabel(label)
            .setValue(value)
            .build());
}
项目:Sprog-App    文件:PoemActivity.java   
@Override
protected void onStart() {
    super.onStart();
    mTracker.setScreenName("Poem");
    mTracker.send(new HitBuilders.ScreenViewBuilder().build());
    trackEvent("PoemPage", presenter.getSelectedPoemID(), null);
}
项目:Sprog-App    文件:PoemActivity.java   
public void trackEvent(String category, String action, String label){
    mTracker.send(new HitBuilders.EventBuilder()
            .setCategory(category)
            .setAction(action)
            .setLabel(label)
            .build());
}
项目:Sprog-App    文件:MainActivity.java   
@Override
protected void onStart() {
    super.onStart();
    mTracker.setScreenName("PoemsList");
    mTracker.send(new HitBuilders.ScreenViewBuilder().build());

    if (mAdapter == null) {
        mAdapter = new PoemsListAdapter(this, presenter, preferences);
        mRecyclerView.setAdapter(mAdapter);
    }
}
项目:Sprog-App    文件:MainActivity.java   
public void trackEvent(String category, String action, String label){
    mTracker.send(new HitBuilders.EventBuilder()
            .setCategory(category)
            .setAction(action)
            .setLabel(label)
            .build());
}
项目:IdealMedia    文件:FoldersFragment.java   
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

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

    Tracker t = ((NavigationActivity)getActivity()).getTracker(NavigationActivity.TrackerName.APP_TRACKER);
    t.setScreenName("Folders and files");
    t.send(new HitBuilders.AppViewBuilder().build());
}
项目:IdealMedia    文件:AlbumsFragment.java   
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view,savedInstanceState);

    list = (RecyclerView)view.findViewById(android.R.id.list);
    list.setItemAnimator(new DefaultItemAnimator());
    setLayoutManager();

    progress = (CircularProgressButton)view.findViewById(android.R.id.progress);
    empty = view.findViewById(android.R.id.empty);

    new AsyncTask<Void, Void, ArrayList<Track>>() {
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            activity.setRefreshing(true);
        }

        @Override
        protected ArrayList<Track> doInBackground(Void... voids) {
            return (ArrayList<Track>) FileUtils.read("albumsTracks", activity);
        }

        @Override
        protected void onPostExecute(ArrayList<Track> tracks) {
            super.onPostExecute(tracks);
            activity.setRefreshing(false);
            OnTaskResult(tracks);
        }
    }.execute();

    Tracker t = ((NavigationActivity)getActivity()).getTracker(NavigationActivity.TrackerName.APP_TRACKER);
    t.setScreenName("Albums");
    t.send(new HitBuilders.AppViewBuilder().build());
}