facebook.isActive

Type Boolean
Revision 2017.3060
Keywords facebook, isActive
See also facebook.*

Overview

Used to confirm that the Facebook plugin is properly initialized after calling require( "plugin.facebook.v4" ). This property will be true if the Facebook plugin was successfully initialized, false otherwise.

Important
  • On iOS, this property will always be true since the Facebook SDK for iOS doesn't have an initialization process that needs to happen asynchronously.

  • Some functions/properties require facebook-v4.isActive to be true before giving reliable results. This is noted in their respective documentation.

Syntax

facebook.isActive

Example

local facebook = require( "plugin.facebook.v4" )

local function enforceFacebookLogin()

    if ( facebook.isActive ) then
        if ( facebook.getCurrentAccessToken() == nil ) then
            print( "Login required!" )
            facebook.login()
        else
            print( "Already logged in." )
        end
    else
        print( "Please wait for facebook to finish initializing before checking the current access token" )
    end
end

enforceFacebookLogin()