Facebook plugin: Any way to check if init is done?

Hi Guys,

Is there any way to see if the initialization of the plugin is done?

If I now use the plugin and call getInstance on it, and then immediately check for isLoggedIn, the later will return false, where as if I check a bit later the isLoggedIn, it will return true.

I’m assuming this is because getInstance performs the plugin init, and that at some point connects to Facebook if the user has connected to it before (and not logged out).

Right now I work around this by instancing facebook as soon as possible, and do the isLoggedIn check after I’ve loaded my resources. But I’d prefer to be able to check or wait for the init to complete…

Does anyone have a clue?

Kind regards,
Michael

I’ve looked into this further, here is the relevant output for the facebook plugin instancing:

// cocos2d::plugin::FacebookAgent::getInstance();
D/PluginFactory(1535): Java class name of plugin ShareFacebook is : org/cocos2dx/plugin/ShareFacebook
I/PluginWrapper(1535): class name : ----org/cocos2dx/plugin/ShareFacebook----
D/PluginFactory(1535): The type of plugin ShareFacebook is : 4
D/PluginFactory(1535): Java class name of plugin UserFacebook is : org/cocos2dx/plugin/UserFacebook
I/PluginWrapper(1535): class name : ----org/cocos2dx/plugin/UserFacebook----
D/PluginFactory(1535): The type of plugin UserFacebook is : 5
I/native-activity(1535): Facebook  => FacebookAgent initialized.
I/System.out(1535): {"accessToken":"<<snip>>","permissions":["publish_actions","user_friends","basic_info"]}

I/native-activity(1535): GameLayer =>onEnterTransitionDidFinish

D/ProtocolUser(1535): nativeOnActionResult(), Get plugin ptr : 0x61064188
D/ProtocolUser(1535): nativeOnActionResult(), Get plugin name : UserFacebook

D/Listener of plugin %s not set correctly(1535): UserFacebook

// m_pFacebookAgent->isLoggedIn() returns true here if the user has connected to fb in a prior run

Why is the UserFacebook Listener not set?
And is there a way I can set it myself?

For now I’ll just check if the user is logged into facebook for the first # ms the game is running, and if it then hasn’t returned true, I’ll just assume it’s not connected.

Proper code would of course be to be able to check if the plugin is done initializing, and if so, check the logged in to facebook status…

Kind regards,
Michaël