本文整理汇总了Java中com.google.analytics.tracking.android.MapBuilder类的典型用法代码示例。如果您正苦于以下问题:Java MapBuilder类的具体用法?Java MapBuilder怎么用?Java MapBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MapBuilder类属于com.google.analytics.tracking.android包,在下文中一共展示了MapBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onOptionsItemSelected
import com.google.analytics.tracking.android.MapBuilder; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
switch (item.getItemId()) {
// Respond to the action bar's Up/Home button
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
case R.id.action_opt_out:
Intent form_intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://goo.gl/forms/3phx3AqTWr"));
startActivity(form_intent);
easyTracker.send(MapBuilder
.createEvent("ui_action", // Event category (required)
"forget_option", // Event action (required)
"forget_clicked", // Event label
null) // Event value
.build());
return true;
}
return super.onOptionsItemSelected(item);
}
示例2: setFavorite
import com.google.analytics.tracking.android.MapBuilder; //导入依赖的package包/类
private void setFavorite(boolean toFavorite) {
if(toFavorite) {
EasyTracker.getInstance(getActivity()).send(MapBuilder
.createEvent(Category.Favorite.name(), mCamera.getTitle(), "favorite", null)
.build());
} else {
EasyTracker.getInstance(getActivity()).send(MapBuilder
.createEvent(Category.Favorite.name(), mCamera.getTitle(), "unfavorite", null)
.build());
}
mCamera.setIsFavorite(toFavorite);
mFavoriteMenuItem.setVisible(!toFavorite);
mUnfavoriteMenuItem.setVisible(toFavorite);
new FavoriteCamera(toFavorite).execute(mCamera);
}
示例3: applicationStartup
import com.google.analytics.tracking.android.MapBuilder; //导入依赖的package包/类
/**
* @param savedInstanceState
*/
private void applicationStartup() {
if(GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) == ConnectionResult.SUCCESS) {
mClient = new LocationClient(this, this, this);
mClient.connect();
} else {
EasyTracker.getInstance(this).send(MapBuilder
.createEvent(Category.Other.name(), "GooglePlayServicesNotAvailable", "", null)
.build());
}
mCities = mGetLatestCamerasTask.getCities();
mCacheParams = new ImageCacheParams("/image-cache");
setImageQuality();
configureAnalytics();
mImageWorker = new ImageFetcher(this, 400);
mImageWorker.setImageCache(ImageCache.findOrCreateCache(this,
mCacheParams));
mImageWorker.setLoadingImage(R.drawable.placeholder_camera);
mFragment.setIsProcessing(false);
mDrawerAdapter = new DrawerListAdapter(this,
Arrays.asList((getResources().getStringArray(R.array.drawer_list_groups))),
mCities);
mDrawerList.setAdapter(mDrawerAdapter);
selectGroup(mDrawerList, getCurrentGroup(), true);
}
示例4: trackView
import com.google.analytics.tracking.android.MapBuilder; //导入依赖的package包/类
private void trackView(String screenname, CallbackContext callbackContext) {
if (! trackerStarted ) {
callbackContext.error("Tracker not started");
return;
}
Tracker tracker = GoogleAnalytics.getInstance(this.cordova.getActivity()).getDefaultTracker();
addCustomDimensionsToTracker(tracker);
if (null != screenname && screenname.length() > 0) {
tracker.set(Fields.SCREEN_NAME, screenname);
tracker.send(MapBuilder
.createAppView()
.build()
);
callbackContext.success("Track Screen: " + screenname);
} else {
callbackContext.error("Expected one non-empty string argument.");
}
}
示例5: trackEvent
import com.google.analytics.tracking.android.MapBuilder; //导入依赖的package包/类
private void trackEvent(String category, String action, String label, long value, CallbackContext callbackContext) {
if (! trackerStarted ) {
callbackContext.error("Tracker not started");
return;
}
Tracker tracker = GoogleAnalytics.getInstance(this.cordova.getActivity()).getDefaultTracker();
addCustomDimensionsToTracker(tracker);
if (null != category && category.length() > 0) {
tracker.send(MapBuilder
.createEvent(category, action, label, value)
.build()
);
callbackContext.success("Track Event: " + category);
} else {
callbackContext.error("Expected non-empty string arguments.");
}
}
示例6: onStart
import com.google.analytics.tracking.android.MapBuilder; //导入依赖的package包/类
@Override
public void onStart() {
super.onStart();
final Tracker tracker = EasyTracker.getInstance(getActivity());
tracker.set(Fields.SCREEN_NAME, "Recipes list");
tracker.send(MapBuilder.createAppView().build());
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(RecipesManager.ACTION_FINISH_LOADING_RECIPES);
intentFilter.addAction(RecipesManager.ACTION_START_LOADING_RECIPES);
if (RecipesApplication.isLoadingRecipes) {
getActivity().setProgressBarIndeterminateVisibility(true);
} else {
getActivity().setProgressBarIndeterminateVisibility(false);
}
LocalBroadcastManager.getInstance(getActivity()).registerReceiver(broadcastReceiver,
intentFilter);
}
示例7: onOptionsItemSelected
import com.google.analytics.tracking.android.MapBuilder; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_favorites) {
recipesRecord.setFavorite(!recipesRecord.getFavorite());
getActivity().supportInvalidateOptionsMenu();
recipesRecord.update(false);
if (recipesRecord.getFavorite()) {
EasyTracker.getInstance(getActivity()).send(
MapBuilder.createEvent("recipe details", "add", "favorites", 1l).build());
} else {
EasyTracker.getInstance(getActivity())
.send(MapBuilder.createEvent("recipe details", "remove", "favorites", 1l)
.build());
}
return true;
} else if (item.getItemId() == R.id.menu_share) {
shareRecipe();
return true;
}
return super.onOptionsItemSelected(item);
}
示例8: onDisableScrobblingOverMobileChanged
import com.google.analytics.tracking.android.MapBuilder; //导入依赖的package包/类
@OnCheckedChanged(R.id.settings_disable_scrobbling_over_mobile_network_switch)
public void onDisableScrobblingOverMobileChanged(boolean isChecked) {
if (isChecked == WAILSettings.isEnableScrobblingOverMobileNetwork(getActivity())) {
return;
}
WAILSettings.setDisableScrobblingOverMobileNetwork(getActivity(), isChecked);
final String toast = isChecked ? getString(R.string.settings_scrobbling_over_mobile_network_enabled_toast)
: getString(R.string.settings_scrobbling_over_mobile_network_disabled_toast);
Toast.makeText(getActivity(), toast, Toast.LENGTH_SHORT).show();
EasyTracker.getInstance(getActivity()).send(
MapBuilder.createEvent(GA_EVENT_SETTINGS_FRAGMENT,
"Scrobbling over mobile network enabled: " + isChecked,
null,
isChecked ? 1L : 0L
).build()
);
}
示例9: onLastfmUpdateNowPlayingChanged
import com.google.analytics.tracking.android.MapBuilder; //导入依赖的package包/类
@OnCheckedChanged(R.id.settings_lastfm_update_nowplaying_switch)
public void onLastfmUpdateNowPlayingChanged(boolean isChecked) {
if (isChecked == WAILSettings.isLastfmNowplayingUpdateEnabled(getActivity())) {
return;
}
WAILSettings.setLastfmNowplayingUpdateEnabled(getActivity(), isChecked);
final String toast = isChecked ? getString(R.string.settings_lastfm_update_nowplaying_enabled_toast)
: getString(R.string.settings_lastfm_update_nowplaying_disabled_toast);
Toast.makeText(getActivity(), toast, Toast.LENGTH_SHORT).show();
EasyTracker.getInstance(getActivity()).send(
MapBuilder.createEvent(GA_EVENT_SETTINGS_FRAGMENT,
"lastFmUpdateNowPlaying enabled: " + isChecked,
null,
isChecked ? 1L : 0L
).build()
);
}
示例10: emailToTheDeveloper
import com.google.analytics.tracking.android.MapBuilder; //导入依赖的package包/类
@OnClick(R.id.settings_email_to_developers)
public void emailToTheDeveloper() {
try {
final Intent emailIntent = new Intent(Intent.ACTION_SEND);
String emailsString = getString(R.string.settings_developers_emails);
String[] emails = emailsString.substring(0, emailsString.indexOf('(') - 1).split(",");
emailIntent.putExtra(Intent.EXTRA_EMAIL, emails);
emailIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.settings_email_to_the_developer_subj) + " " + buildVersionDescTextView.getText().toString());
emailIntent.setType("message/rfc822");
startActivity(Intent.createChooser(emailIntent, getString(R.string.settings_email_dialog_title)));
EasyTracker.getInstance(getActivity())
.send(MapBuilder.createEvent(GA_EVENT_SETTINGS_FRAGMENT,
"emailToTheDeveloperClicked",
null,
1L).build());
} catch (Exception e) {
EasyTracker.getInstance(getActivity())
.send(MapBuilder.createException("Can not send email to the developer: " + e, false).build());
}
}
示例11: onStatusBarNotificationSwitchChanged
import com.google.analytics.tracking.android.MapBuilder; //导入依赖的package包/类
@OnCheckedChanged(R.id.settings_status_bar_notifications_track_now_scrobbling_switch)
public void onStatusBarNotificationSwitchChanged(boolean isChecked) {
if (isChecked == WAILSettings.isStatusBarNotificationTrackScrobblingEnabled(getActivity())) {
return;
}
WAILSettings.setStatusBarNotificationTrackScrobblingEnabled(getActivity(), isChecked);
if (isChecked) {
Track track = WAILSettings.getNowScrobblingTrack(getActivity());
if (track != null) {
StatusBarNotificationsManager.getInstance(getActivity())
.showTrackScrobblingStatusBarNotification(track);
}
setMinPriorityEnabled(true);
} else {
StatusBarNotificationsManager.getInstance(getActivity()).cancelAllNotifications();
setMinPriorityEnabled(false);
}
EasyTracker.getInstance(getActivity()).send(MapBuilder.createEvent(GA_EVENT_SETTINGS_STATUS_BAR_NOTIFICATIONS,
"nowPlayingStatusBarNotifications",
isChecked ? "enabled" : "disabled",
isChecked ? 1L : 0L).build());
}
开发者ID:artem-zinnatullin,项目名称:android-wail-app,代码行数:26,代码来源:SettingsStatusBarNotificationsFragment.java
示例12: onItemClick
import com.google.analytics.tracking.android.MapBuilder; //导入依赖的package包/类
@OnItemClick(R.id.settings_select_language_list_view)
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
switch (i) {
case 0:
LocaleUtil.updateLanguage(getActivity(), Locale.getDefault().getDisplayLanguage());
break;
default:
String language = languages[i];
if (language.contains("(")) {
language = language.substring(0, language.indexOf("(") - 1);
}
LocaleUtil.updateLanguage(getActivity(), language);
break;
}
EasyTracker.getInstance(getActivity()).send(MapBuilder.createEvent(
GA_EVENT_SETTINGS_SELECT_LANGUAGE,
"languageChangedTo",
i == 0 ? "default" : languages[i],
0L
).build());
getActivity().finish();
}
示例13: trackEvents
import com.google.analytics.tracking.android.MapBuilder; //导入依赖的package包/类
/**
* <p>for GoogleAnalytics, follow this order; </p>
* <p>1- Event category (required)</p>
* <p>2- Event action (required)</p>
* <p>3- Event label</p>
* <p>4- Event value </p>
*
* @param params
* @see <a href="https://developers.google.com/analytics/devguides/collection/android/v3/events">
* GoogleAnalytics Getting Started</a
*/
@Override
public boolean trackEvents(String... params) {
if(params.length < 3) {
throw new NullPointerException(" Must send at least 2 params for GoogleAnalytics ");
}
Long value = null;
try {
value = Long.parseLong(params[3]);
} catch (Exception e) {
return false;
}
mTracker.send(MapBuilder.createEvent(params[0], params[1], params[2], value).build());
return true;
}
示例14: onDestroy
import com.google.analytics.tracking.android.MapBuilder; //导入依赖的package包/类
@Override
protected void onDestroy() {
super.onDestroy();
if (isFinishing()) {
SharedPreferences prefs = getSharedPreferences("camera", 0);
SharedPreferences.Editor editor = prefs.edit();
CameraPosition cameraPos = mGoogleMap.getCameraPosition();
editor.putFloat(PREVIOUS_LATITUDE, (float)cameraPos.target.latitude);
editor.putFloat(PREVIOUS_LONGITUDE, (float) cameraPos.target.longitude);
editor.putFloat(PREVIOUS_ZOOM, cameraPos.zoom);
editor.commit();
if(isRecording)
startRecording();
if(personalizedToggleOnTimestamp != 0)
EasyTracker.getInstance(this).send(MapBuilder.createTiming("view_time", (System.currentTimeMillis() - personalizedToggleOnTimestamp), "personalized_view_time", "disabled_by_activity_destroy").build());
}
if(startPositionMarker != null){
startPositionMarker.remove();
startPositionMarker = null;
}
if(stopPositionMarker != null){
stopPositionMarker.remove();
stopPositionMarker = null;
}
}
示例15: onItemClick
import com.google.analytics.tracking.android.MapBuilder; //导入依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
EasyTracker.getInstance(ctx).send(MapBuilder.createEvent("ui_action", "button_press", "on_recording", null).build());
mGoogleMap.clear();
mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(routes.get(position).get(0),16.0f));
mGoogleMap.addPolyline(new PolylineOptions().addAll(routes.get(position)).width(10.0f).color(Color.argb(255, 0, 255, 255)));
TextView tv = (TextView) dialog.findViewById(R.id.recordings_dialog_duration_text_view);
tv.setText(recAdapter.getItem(position).duration);
tv.bringToFront();
TextView tv2 = (TextView) dialog.findViewById(R.id.recordings_dialog_distance_text_view);
tv2.setText(recAdapter.getItem(position).distance);
tv2.bringToFront();
TextView tv3 = (TextView) dialog.findViewById(R.id.recordings_dialog_speed_text_view);
tv3.setText(recAdapter.getItem(position).speed);
tv3.bringToFront();
dialog.show();
tv.invalidate();
tv2.invalidate();
}