本文整理匯總了Java中com.facebook.AppEventsLogger.newLogger方法的典型用法代碼示例。如果您正苦於以下問題:Java AppEventsLogger.newLogger方法的具體用法?Java AppEventsLogger.newLogger怎麽用?Java AppEventsLogger.newLogger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.facebook.AppEventsLogger
的用法示例。
在下文中一共展示了AppEventsLogger.newLogger方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: logAppEvents
import com.facebook.AppEventsLogger; //導入方法依賴的package包/類
@Override
void logAppEvents(boolean doneButtonClicked) {
AppEventsLogger logger = AppEventsLogger.newLogger(this.getActivity(), getSession());
Bundle parameters = new Bundle();
// If Done was clicked, we know this completed successfully. If not, we don't know (caller might have
// dismissed us in response to selection changing, or user might have hit back button). Either way
// we'll log the number of selections.
String outcome = doneButtonClicked ? AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_COMPLETED :
AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_UNKNOWN;
parameters.putString(AnalyticsEvents.PARAMETER_DIALOG_OUTCOME, outcome);
parameters.putInt("num_friends_picked", getSelection().size());
logger.logSdkEvent(AnalyticsEvents.EVENT_FRIEND_PICKER_USAGE, null, parameters);
}
示例2: logAppEvents
import com.facebook.AppEventsLogger; //導入方法依賴的package包/類
@Override
void logAppEvents(boolean doneButtonClicked) {
AppEventsLogger logger = AppEventsLogger.newLogger(this.getActivity(), getSession());
Bundle parameters = new Bundle();
// If Done was clicked, we know this completed successfully. If not, we don't know (caller might have
// dismissed us in response to selection changing, or user might have hit back button). Either way
// we'll log the number of selections.
String outcome = doneButtonClicked ? AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_COMPLETED :
AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_UNKNOWN;
parameters.putString(AnalyticsEvents.PARAMETER_DIALOG_OUTCOME, outcome);
parameters.putInt("num_places_picked", (getSelection() != null) ? 1 : 0);
logger.logSdkEvent(AnalyticsEvents.EVENT_PLACE_PICKER_USAGE, null, parameters);
}
示例3: logDialogActivity
import com.facebook.AppEventsLogger; //導入方法依賴的package包/類
private static void logDialogActivity(Activity paramActivity, iF paramiF, String paramString1, String paramString2)
{
Object localObject;
if (paramiF != null)
localObject = paramiF.getActivity();
else
localObject = paramActivity;
AppEventsLogger localAppEventsLogger = AppEventsLogger.newLogger((Context)localObject);
Bundle localBundle = new Bundle();
localBundle.putString("fb_dialog_outcome", paramString2);
localAppEventsLogger.logSdkEvent(paramString1, null, localBundle);
}
示例4: onClick
import com.facebook.AppEventsLogger; //導入方法依賴的package包/類
@Override
public void onClick(View v) {
Context context = getContext();
final Session openSession = sessionTracker.getOpenSession();
if (openSession != null) {
// If the Session is currently open, it must mean we need to 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;
if (user != null && user.getName() != null) {
message = String.format(getResources().getString(R.string.com_facebook_loginview_logged_in_as), user.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) {
openSession.closeAndClearTokenInformation();
}
})
.setNegativeButton(cancel, null);
builder.create().show();
} else {
openSession.closeAndClearTokenInformation();
}
} else {
Session currentSession = sessionTracker.getSession();
if (currentSession == null || currentSession.getState().isClosed()) {
sessionTracker.setSession(null);
Session session = new Session.Builder(context).setApplicationId(applicationId).build();
Session.setActiveSession(session);
currentSession = session;
}
if (!currentSession.isOpened()) {
Session.OpenRequest openRequest = null;
if (parentFragment != null) {
openRequest = new Session.OpenRequest(parentFragment);
} else if (context instanceof Activity) {
openRequest = new Session.OpenRequest((Activity)context);
}
if (openRequest != null) {
openRequest.setDefaultAudience(properties.defaultAudience);
openRequest.setPermissions(properties.permissions);
openRequest.setLoginBehavior(properties.loginBehavior);
if (SessionAuthorizationType.PUBLISH.equals(properties.authorizationType)) {
currentSession.openForPublish(openRequest);
} else {
currentSession.openForRead(openRequest);
}
}
}
}
AppEventsLogger logger = AppEventsLogger.newLogger(getContext());
Bundle parameters = new Bundle();
parameters.putInt("logging_in", (openSession != null) ? 0 : 1);
logger.logSdkEvent(loginLogoutEventName, null, parameters);
}