本文整理匯總了Java中com.facebook.internal.AnalyticsEvents類的典型用法代碼示例。如果您正苦於以下問題:Java AnalyticsEvents類的具體用法?Java AnalyticsEvents怎麽用?Java AnalyticsEvents使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AnalyticsEvents類屬於com.facebook.internal包,在下文中一共展示了AnalyticsEvents類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: toggleLike
import com.facebook.internal.AnalyticsEvents; //導入依賴的package包/類
/**
* Entry-point to the code that performs the like/unlike action.
*/
public void toggleLike(Activity activity, Fragment fragment, Bundle analyticsParameters) {
boolean shouldLikeObject = !this.isObjectLiked;
if (canUseOGPublish()) {
// Update UI Like state optimistically
updateLikeState(shouldLikeObject);
if (isPendingLikeOrUnlike) {
// If the user toggled the button quickly, and there is still a publish underway,
// don't fire off another request. Also log this behavior.
getAppEventsLogger().logSdkEvent(
AnalyticsEvents.EVENT_LIKE_VIEW_DID_UNDO_QUICKLY,
null,
analyticsParameters);
} else if (!publishLikeOrUnlikeAsync(shouldLikeObject, analyticsParameters)) {
// We were not able to send a graph request to unlike or like the object
// Undo the optimistic state-update and show the dialog instead
updateLikeState(!shouldLikeObject);
presentLikeDialog(activity, fragment, analyticsParameters);
}
} else {
presentLikeDialog(activity, fragment, analyticsParameters);
}
}
示例2: onCreateView
import com.facebook.internal.AnalyticsEvents; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.com_facebook_usersettingsfragment, container, false);
loginButton = (LoginButton) view.findViewById(R.id.com_facebook_usersettingsfragment_login_button);
loginButton.setProperties(loginButtonProperties);
loginButton.setFragment(this);
loginButton.setLoginLogoutEventName(AnalyticsEvents.EVENT_USER_SETTINGS_USAGE);
Session session = getSession();
if (session != null && !session.equals(Session.getActiveSession())) {
loginButton.setSession(session);
}
connectedStateLabel = (TextView) view.findViewById(R.id.com_facebook_usersettingsfragment_profile_name);
// if no background is set for some reason, then default to Facebook blue
if (view.getBackground() == null) {
view.setBackgroundColor(getResources().getColor(R.color.com_facebook_blue));
} else {
view.getBackground().setDither(true);
}
return view;
}
示例3: present
import com.facebook.internal.AnalyticsEvents; //導入依賴的package包/類
/**
* Launches an activity in the Facebook application to present the desired dialog. This method returns a
* PendingCall that contains a unique ID associated with this call to the Facebook application. In general,
* a calling Activity should use UiLifecycleHelper to handle incoming activity results, in order to ensure
* proper processing of the results from this dialog.
*
* @return a PendingCall containing the unique call ID corresponding to this call to the Facebook application
*/
public PendingCall present() {
logDialogActivity(activity, fragment, getEventName(appCall.getRequestIntent()),
AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_COMPLETED);
if (onPresentCallback != null) {
try {
onPresentCallback.onPresent(activity);
} catch (Exception e) {
throw new FacebookException(e);
}
}
if (fragment != null) {
fragment.startActivityForResult(appCall.getRequestIntent(), appCall.getRequestCode());
} else {
activity.startActivityForResult(appCall.getRequestIntent(), appCall.getRequestCode());
}
return appCall;
}
示例4: getEventName
import com.facebook.internal.AnalyticsEvents; //導入依賴的package包/類
static private String getEventName(String action, boolean hasPhotos) {
String eventName;
if (action.equals(NativeProtocol.ACTION_FEED_DIALOG)) {
eventName = hasPhotos ?
AnalyticsEvents.EVENT_NATIVE_DIALOG_TYPE_PHOTO_SHARE :
AnalyticsEvents.EVENT_NATIVE_DIALOG_TYPE_SHARE;
} else if (action.equals(NativeProtocol.ACTION_MESSAGE_DIALOG)) {
eventName = hasPhotos ?
AnalyticsEvents.EVENT_NATIVE_DIALOG_TYPE_PHOTO_MESSAGE :
AnalyticsEvents.EVENT_NATIVE_DIALOG_TYPE_MESSAGE;
} else if (action.equals(NativeProtocol.ACTION_OGACTIONPUBLISH_DIALOG)) {
eventName = AnalyticsEvents.EVENT_NATIVE_DIALOG_TYPE_OG_SHARE;
} else if (action.equals(NativeProtocol.ACTION_OGMESSAGEPUBLISH_DIALOG)) {
eventName = AnalyticsEvents.EVENT_NATIVE_DIALOG_TYPE_OG_MESSAGE;
} else {
throw new FacebookException("An unspecified action was presented");
}
return eventName;
}
示例5: build
import com.facebook.internal.AnalyticsEvents; //導入依賴的package包/類
/**
* Constructs a FacebookDialog with an Intent that is correctly populated to present the dialog within
* the Facebook application.
*
* @return a FacebookDialog instance
*/
public FacebookDialog build() {
validate();
Bundle extras = new Bundle();
putExtra(extras, NativeProtocol.EXTRA_APPLICATION_ID, applicationId);
putExtra(extras, NativeProtocol.EXTRA_APPLICATION_NAME, applicationName);
extras = setBundleExtras(extras);
String action = getActionForFeatures(getDialogFeatures());
int protocolVersion = getProtocolVersionForNativeDialog(activity, action,
getMinVersionForFeatures(getDialogFeatures()));
Intent intent = NativeProtocol.createPlatformActivityIntent(activity, action, protocolVersion, extras);
if (intent == null) {
logDialogActivity(activity, fragment,
getEventName(action, extras.containsKey(NativeProtocol.EXTRA_PHOTOS)),
AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_FAILED);
throw new FacebookException(
"Unable to create Intent; this likely means the Facebook app is not installed.");
}
appCall.setRequestIntent(intent);
return new FacebookDialog(activity, fragment, appCall, getOnPresentCallback());
}
示例6: tryAuthorize
import com.facebook.internal.AnalyticsEvents; //導入依賴的package包/類
@Override
boolean tryAuthorize(AuthorizationRequest request) {
applicationId = request.getApplicationId();
Intent intent = NativeProtocol.createLoginDialog20121101Intent(context, request.getApplicationId(),
new ArrayList<String>(request.getPermissions()),
request.getDefaultAudience().getNativeProtocolAudience());
if (intent == null) {
return false;
}
callId = intent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID);
addLoggingExtra(EVENT_EXTRAS_APP_CALL_ID, callId);
addLoggingExtra(EVENT_EXTRAS_PROTOCOL_VERSION,
intent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
addLoggingExtra(EVENT_EXTRAS_PERMISSIONS,
TextUtils.join(",", intent.getStringArrayListExtra(NativeProtocol.EXTRA_PERMISSIONS)));
addLoggingExtra(EVENT_EXTRAS_WRITE_PRIVACY, intent.getStringExtra(NativeProtocol.EXTRA_WRITE_PRIVACY));
logEvent(AnalyticsEvents.EVENT_NATIVE_LOGIN_DIALOG_START,
AnalyticsEvents.PARAMETER_NATIVE_LOGIN_DIALOG_START_TIME, callId);
return tryIntent(intent, request.getRequestCode());
}
示例7: tryAuthorize
import com.facebook.internal.AnalyticsEvents; //導入依賴的package包/類
@Override
boolean tryAuthorize(AuthorizationRequest request) {
applicationId = request.getApplicationId();
Intent intent = NativeProtocol.createLoginDialog20121101Intent(context, request.getApplicationId(),
new ArrayList<String>(request.getPermissions()),
request.getDefaultAudience().getNativeProtocolAudience());
if (intent == null) {
return false;
}
callId = intent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID);
addLoggingExtra(EVENT_EXTRAS_APP_CALL_ID, callId);
addLoggingExtra(EVENT_EXTRAS_PROTOCOL_VERSION,
""+intent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,0));
addLoggingExtra(EVENT_EXTRAS_PERMISSIONS,
TextUtils.join(",", intent.getStringArrayListExtra(NativeProtocol.EXTRA_PERMISSIONS)));
addLoggingExtra(EVENT_EXTRAS_WRITE_PRIVACY, intent.getStringExtra(NativeProtocol.EXTRA_WRITE_PRIVACY));
logEvent(AnalyticsEvents.EVENT_NATIVE_LOGIN_DIALOG_START,
AnalyticsEvents.PARAMETER_NATIVE_LOGIN_DIALOG_START_TIME, callId);
return tryIntent(intent, request.getRequestCode());
}