Skip to content

Android - facebook login dialog misbehaves and results in an error response if the dialog is launched in a different screen orientation than the app's screen orientation. #63

@msesen

Description

@msesen
  • Game is launched in landscape mode.
  • Screen rotation is locked on android device.
  • Upon clicking on the “Facebok login” button, the login dialog is launched in portrait mode.
  • If already logged in, Facebook informs you that you have previously logged into this app. Clicking on the Continue button closes the dialog and immidiately launches the dialog again. Clicking on the Continue button for the second time closes the dialog with an error {status = 0, error = “Aborted”}.

If I disable the screen rotration lock, then it works (if the device is held in landscape mode, otherwise the dialog will launch in portrait mode). The login dialog is launched in landscape mode, clicking on the Continue button returns to the app with the success payload of status = 200. HTML 5 build also works. But unfortunately, I need the game in landscape mode.

Could it be that the Activity that launches the dialog gets destroyed upon screen rotation?

Defold Editor 1.9.0, and the extension version is 9.0.0.

Here is a sample code.

local function facebookLogin(self, data)

    if data.status == facebook.STATE_OPEN then
        -- Logged in ok.

    elseif data.status == facebook.STATE_CLOSED_LOGIN_FAILED then
        -- Do something to indicate that login failed

    end

    if data.error then
        -- .. something went wrong
    end
end


local function onFacebookLoginBtnClick(self)
    if not facebook then
        -- Facebook login is not available for this device.
        return
    end

    -- Login with read permissions.
    local permissions = { "public_profile" }
    facebook.login_with_permissions(permissions, facebook.AUDIENCE_EVERYONE, facebookLogin)
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions