com.facebook.internal.AnalyticsEvents Java Examples

The following examples show how to use com.facebook.internal.AnalyticsEvents. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UserSettingsFragment.java    From facebook-api-android-maven with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #2
Source File: LikeActionController.java    From kognitivo with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #3
Source File: FacebookDialog.java    From facebook-api-android-maven with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #4
Source File: FimiMediaCodecInfo.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public static String getProfileName(int profile) {
    switch (profile) {
        case 1:
            return "Baseline";
        case 2:
            return "Main";
        case 4:
            return "Extends";
        case 8:
            return "High";
        case 16:
            return "High10";
        case 32:
            return "High422";
        case 64:
            return "High444";
        default:
            return AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_UNKNOWN;
    }
}
 
Example #5
Source File: AuthorizationClient.java    From platform-friends-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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());
}
 
Example #6
Source File: UserSettingsFragment.java    From platform-friends-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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;
}
 
Example #7
Source File: UserSettingsFragment.java    From Klyph with MIT License 6 votes vote down vote up
@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;
}
 
Example #8
Source File: FimiMediaCodecInfo.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public static String getProfileName(int profile) {
    switch (profile) {
        case 1:
            return "Baseline";
        case 2:
            return "Main";
        case 4:
            return "Extends";
        case 8:
            return "High";
        case 16:
            return "High10";
        case 32:
            return "High422";
        case 64:
            return "High444";
        default:
            return AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_UNKNOWN;
    }
}
 
Example #9
Source File: UserSettingsFragment.java    From barterli_android with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #10
Source File: FacebookDialog.java    From facebook-api-android-maven with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #11
Source File: FacebookDialog.java    From android-skeleton-project with MIT License 6 votes vote down vote up
/**
 * 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;
}
 
Example #12
Source File: FacebookDialog.java    From android-skeleton-project with MIT License 6 votes vote down vote up
/**
 * 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());
}
 
Example #13
Source File: AuthorizationClient.java    From barterli_android with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #14
Source File: UserSettingsFragment.java    From KlyphMessenger with MIT License 6 votes vote down vote up
@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;
}
 
Example #15
Source File: AuthorizationClient.java    From KlyphMessenger with MIT License 6 votes vote down vote up
@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());
}
 
Example #16
Source File: FacebookDialog.java    From Abelana-Android with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #17
Source File: FacebookDialog.java    From Abelana-Android with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #18
Source File: FacebookDialog.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
/**
 * 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());
}
 
Example #19
Source File: FacebookDialog.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
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;
}
 
Example #20
Source File: FacebookDialog.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
/**
 * 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;
}
 
Example #21
Source File: UserSettingsFragment.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@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;
}
 
Example #22
Source File: FacebookDialog.java    From android-skeleton-project with MIT License 6 votes vote down vote up
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;
}
 
Example #23
Source File: FriendPickerFragment.java    From FacebookImageShareIntent with MIT License 5 votes vote down vote up
@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);
}
 
Example #24
Source File: AuthorizationClient.java    From android-skeleton-project with MIT License 5 votes vote down vote up
private void logWebLoginCompleted(String applicationId, String e2e) {
    AppEventsLogger appEventsLogger = AppEventsLogger.newLogger(context, 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);
}
 
Example #25
Source File: PlacePickerFragment.java    From FacebookImageShareIntent with MIT License 5 votes vote down vote up
@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);
}
 
Example #26
Source File: LikeActionController.java    From kognitivo with Apache License 2.0 5 votes vote down vote up
private void logAppEventForError(String action, Bundle parameters) {
    Bundle logParams = new Bundle(parameters);
    logParams.putString(AnalyticsEvents.PARAMETER_LIKE_VIEW_OBJECT_ID, objectId);
    logParams.putString(AnalyticsEvents.PARAMETER_LIKE_VIEW_OBJECT_TYPE, objectType.toString());
    logParams.putString(AnalyticsEvents.PARAMETER_LIKE_VIEW_CURRENT_ACTION, action);

    getAppEventsLogger().logSdkEvent(AnalyticsEvents.EVENT_LIKE_VIEW_ERROR, null, logParams);
}
 
Example #27
Source File: LikeActionController.java    From kognitivo with Apache License 2.0 5 votes vote down vote up
private void logAppEventForError(String action, FacebookRequestError error) {
    Bundle logParams = new Bundle();
    if (error != null) {
        JSONObject requestResult = error.getRequestResult();
        if (requestResult != null) {
            logParams.putString(
                    AnalyticsEvents.PARAMETER_LIKE_VIEW_ERROR_JSON,
                    requestResult.toString());
        }
    }
    logAppEventForError(action, logParams);
}
 
Example #28
Source File: ShareInternalUtility.java    From kognitivo with Apache License 2.0 5 votes vote down vote up
static void invokeOnSuccessCallback(
        FacebookCallback<Sharer.Result> callback,
        String postId) {
    logShareResult(AnalyticsEvents.PARAMETER_SHARE_OUTCOME_SUCCEEDED, null);
    if (callback != null) {
        callback.onSuccess(new Sharer.Result(postId));
    }
}
 
Example #29
Source File: ShareInternalUtility.java    From kognitivo with Apache License 2.0 5 votes vote down vote up
static void invokeOnErrorCallback(
        FacebookCallback<Sharer.Result> callback,
        GraphResponse response,
        String message) {
    logShareResult(AnalyticsEvents.PARAMETER_SHARE_OUTCOME_ERROR, message);
    if (callback != null) {
        callback.onError(new FacebookGraphResponseException(response, message));
    }
}
 
Example #30
Source File: ShareInternalUtility.java    From kognitivo with Apache License 2.0 5 votes vote down vote up
static void invokeOnErrorCallback(
        FacebookCallback<Sharer.Result> callback,
        FacebookException ex) {
    logShareResult(AnalyticsEvents.PARAMETER_SHARE_OUTCOME_ERROR, ex.getMessage());
    if (callback != null) {
        callback.onError(ex);
    }
}