本文整理匯總了Java中com.facebook.appevents.AppEventsLogger.logSdkEvent方法的典型用法代碼示例。如果您正苦於以下問題:Java AppEventsLogger.logSdkEvent方法的具體用法?Java AppEventsLogger.logSdkEvent怎麽用?Java AppEventsLogger.logSdkEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.facebook.appevents.AppEventsLogger
的用法示例。
在下文中一共展示了AppEventsLogger.logSdkEvent方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: logShareResult
import com.facebook.appevents.AppEventsLogger; //導入方法依賴的package包/類
private static void logShareResult(String shareOutcome, String errorMessage) {
Context context = FacebookSdk.getApplicationContext();
AppEventsLogger logger = AppEventsLogger.newLogger(context);
Bundle parameters = new Bundle();
parameters.putString(
AnalyticsEvents.PARAMETER_SHARE_OUTCOME,
shareOutcome
);
if (errorMessage != null) {
parameters.putString(AnalyticsEvents.PARAMETER_SHARE_ERROR_MESSAGE, errorMessage);
}
logger.logSdkEvent(AnalyticsEvents.EVENT_SHARE_RESULT, null, parameters);
}
示例2: logWebLoginCompleted
import com.facebook.appevents.AppEventsLogger; //導入方法依賴的package包/類
protected void logWebLoginCompleted(String e2e) {
String applicationId = loginClient.getPendingRequest().getApplicationId();
AppEventsLogger appEventsLogger =
AppEventsLogger.newLogger(loginClient.getActivity(), applicationId);
Bundle parameters = new Bundle();
parameters.putString(AnalyticsEvents.PARAMETER_WEB_LOGIN_E2E, e2e);
parameters.putLong(
AnalyticsEvents.PARAMETER_WEB_LOGIN_SWITCHBACK_TIME, System.currentTimeMillis());
parameters.putString(AnalyticsEvents.PARAMETER_APP_ID, applicationId);
appEventsLogger.logSdkEvent(AnalyticsEvents.EVENT_WEB_LOGIN_COMPLETE, null, parameters);
}
示例3: logDialogActivity
import com.facebook.appevents.AppEventsLogger; //導入方法依賴的package包/類
public static void logDialogActivity(
Context context,
String eventName,
String outcome) {
AppEventsLogger logger = AppEventsLogger.newLogger(context);
Bundle parameters = new Bundle();
parameters.putString(AnalyticsEvents.PARAMETER_DIALOG_OUTCOME, outcome);
logger.logSdkEvent(eventName, null, parameters);
}
示例4: logButtonCreated
import com.facebook.appevents.AppEventsLogger; //導入方法依賴的package包/類
private void logButtonCreated(final Context context) {
AppEventsLogger logger = AppEventsLogger.newLogger(context);
logger.logSdkEvent(analyticsButtonCreatedEventName, null, null);
}
示例5: logButtonTapped
import com.facebook.appevents.AppEventsLogger; //導入方法依賴的package包/類
private void logButtonTapped(final Context context) {
AppEventsLogger logger = AppEventsLogger.newLogger(context);
logger.logSdkEvent(analyticsButtonTappedEventName, null, null);
}
示例6: logDialogShare
import com.facebook.appevents.AppEventsLogger; //導入方法依賴的package包/類
private void logDialogShare(Context context, ShareContent content, Mode mode) {
String displayType;
if (isAutomaticMode) {
mode = Mode.AUTOMATIC;
}
switch (mode) {
case AUTOMATIC:
displayType = AnalyticsEvents.PARAMETER_SHARE_DIALOG_SHOW_AUTOMATIC;
break;
case WEB:
displayType = AnalyticsEvents.PARAMETER_SHARE_DIALOG_SHOW_WEB;
break;
case NATIVE:
displayType = AnalyticsEvents.PARAMETER_SHARE_DIALOG_SHOW_NATIVE;
break;
default:
displayType = AnalyticsEvents.PARAMETER_SHARE_DIALOG_SHOW_UNKNOWN;
break;
}
String contentType;
DialogFeature dialogFeature = getFeature(content.getClass());
if (dialogFeature == ShareDialogFeature.SHARE_DIALOG) {
contentType = AnalyticsEvents.PARAMETER_SHARE_DIALOG_CONTENT_STATUS;
} else if (dialogFeature == ShareDialogFeature.PHOTOS) {
contentType = AnalyticsEvents.PARAMETER_SHARE_DIALOG_CONTENT_PHOTO;
} else if (dialogFeature == ShareDialogFeature.VIDEO) {
contentType = AnalyticsEvents.PARAMETER_SHARE_DIALOG_CONTENT_VIDEO;
} else if (dialogFeature == OpenGraphActionDialogFeature.OG_ACTION_DIALOG) {
contentType = AnalyticsEvents.PARAMETER_SHARE_DIALOG_CONTENT_OPENGRAPH;
} else {
contentType = AnalyticsEvents.PARAMETER_SHARE_DIALOG_CONTENT_UNKNOWN;
}
AppEventsLogger logger = AppEventsLogger.newLogger(context);
Bundle parameters = new Bundle();
parameters.putString(
AnalyticsEvents.PARAMETER_SHARE_DIALOG_SHOW,
displayType
);
parameters.putString(
AnalyticsEvents.PARAMETER_SHARE_DIALOG_CONTENT_TYPE,
contentType
);
logger.logSdkEvent(AnalyticsEvents.EVENT_SHARE_DIALOG_SHOW, null, parameters);
}
示例7: onClick
import com.facebook.appevents.AppEventsLogger; //導入方法依賴的package包/類
@Override
public void onClick(View v) {
callExternalOnClickListener(v);
Context context = getContext();
AccessToken accessToken = AccessToken.getCurrentAccessToken();
if (accessToken != null) {
// Log out
if (confirmLogout) {
// Create a confirmation dialog
String logout = getResources().getString(
R.string.com_facebook_loginview_log_out_action);
String cancel = getResources().getString(
R.string.com_facebook_loginview_cancel_action);
String message;
Profile profile = Profile.getCurrentProfile();
if (profile != null && profile.getName() != null) {
message = String.format(
getResources().getString(
R.string.com_facebook_loginview_logged_in_as),
profile.getName());
} else {
message = getResources().getString(
R.string.com_facebook_loginview_logged_in_using_facebook);
}
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(message)
.setCancelable(true)
.setPositiveButton(logout, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
getLoginManager().logOut();
}
})
.setNegativeButton(cancel, null);
builder.create().show();
} else {
getLoginManager().logOut();
}
} else {
LoginManager loginManager = getLoginManager();
loginManager.setDefaultAudience(getDefaultAudience());
loginManager.setLoginBehavior(getLoginBehavior());
if (LoginAuthorizationType.PUBLISH.equals(properties.authorizationType)) {
if (LoginButton.this.getFragment() != null) {
loginManager.logInWithPublishPermissions(
LoginButton.this.getFragment(),
properties.permissions);
} else {
loginManager.logInWithPublishPermissions(
LoginButton.this.getActivity(),
properties.permissions);
}
} else {
if (LoginButton.this.getFragment() != null) {
loginManager.logInWithReadPermissions(
LoginButton.this.getFragment(),
properties.permissions);
} else {
loginManager.logInWithReadPermissions(
LoginButton.this.getActivity(),
properties.permissions);
}
}
}
AppEventsLogger logger = AppEventsLogger.newLogger(getContext());
Bundle parameters = new Bundle();
parameters.putInt("logging_in", (accessToken != null) ? 0 : 1);
logger.logSdkEvent(loginLogoutEventName, null, parameters);
}