Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Regular Contributor
JimmyO
Posts: 93
Registered: ‎02-03-2011
My Device: Not Specified

Re: Facebook integration error on login

I think I am 5 steps behind you on this one, but thought I would ask in this message stream in case anyone has the same issue I do.  I am developing an app where I want users to be able to login using their Facebook account.  I am using the Flash / Facebook libraries that you are referrring to in this message.

 

I have it working properly in Flash Pro - when you login, a popup appears that asks the user to sign in to FaceBook.

 

However when I install this on the PlayBook, the popup does not appear.

 

How does one get the login popup to happen?

 

Thanks in advance for any help you can provide.

 

Jim

 

Please use plain text.
Developer
ChappyK
Posts: 75
Registered: ‎09-13-2011
My Device: Playbook
My Carrier: None

Re: Facebook integration error on login

Can you post a sample of the code you are using?


Show your support and click on the like button when you see a post that was helpful.
Please use plain text.
Regular Contributor
JimmyO
Posts: 93
Registered: ‎02-03-2011
My Device: Not Specified

Re: Facebook integration error on login

Sure.

 

In the code below, 'addText' is a function that outputs to a scrolling textbox for debug purposes.  

 

There are 3 separate buttons on the desktop, each of which separately trigger - goinit, gologon, gohello.

 

When I run this in flash pro, I can successfully goinit, then gologon (a facebook popup window opens asking for my email and password) and then gohello (the debug textbox says my name).

 

///////code here:

 

import com.facebook.graph.FacebookDesktop;

 

var appID:smileyfrustrated:tring = "app id removed for posting here but it is valid";

 

addText("start; ");

 

function init():void {
addText("in init; ");
FacebookDesktop.init(appID, handleLogin);
}

function doLogin():void {
addText("in dologin; ");
FacebookDesktop.login(handleLogin, []);
}

function handleLogin(session:smileysurprised:bject, fail:smileysurprised:bject):void {
addText("in hL; ");
if (session != null) {
addText("Successfully Logged In; ");
} else {
addText("unsuccessful at login; ");
}
}

function sayHello():void {
addText("Hello " + FacebookDesktop.getSession().user.name + "; ");
}

function goinit(evt:MouseEvent):void {
init();
}

function gologin(evt:MouseEvent):void {
doLogin();
}

function gohello(evt:MouseEvent):void {
sayHello();
}

 

Please use plain text.
Contributor
drfrancky
Posts: 31
Registered: ‎10-22-2011
My Device: Playbook
My Carrier: no carrier

Re: Facebook integration error on login

in function doLogin you need to set the web stage for the login... something like this :

private function doLogin():void {

var facebookWebView:smileyfrustrated:tageWebView = new StageWebView();    // web stage for the login

var permissions:Array = ["user_about_me"]; // set desired permisions here

facebookWebView.viewPort = new Rectangle(0,0,stage.width,stage.height);     // this is what i mean, put the size of the dialog here

FacebookMobile.login(handleLogin,this.stage, permissions,facebookWebView,"wap"); // notice the "wap" parameter - it's inportant , otherwise you will get errors on the login.

}

_______________________________________________________
Check my apps for Playbook at AppWorld:
Flash Video Player
Playbook Gallery for Facebook
Playbook Stream Player
Please use plain text.
Developer
ChappyK
Posts: 75
Registered: ‎09-13-2011
My Device: Playbook
My Carrier: None

Re: Facebook integration error on login

Using FacebookDesktop won't work either, if you use the debugger it will throw an error referring to not having a compatible browser. It's looking for a desktop version of a browser. You should use FacebookMobile instead. Plus refer to above post as well


Show your support and click on the like button when you see a post that was helpful.
Please use plain text.
Regular Contributor
JimmyO
Posts: 93
Registered: ‎02-03-2011
My Device: Not Specified

Re: Facebook integration error on login

Thank you so much for the help!  Using the above two comments I now have a popup window.  However, in that popup window, when the user enters their email address and password, the text does not show up and the cursor does not advance EXCEPT when you make the onscreen keyboard disappear (ie you can type what you want, it does not show up, then make the keyboard disappear and what you type shows up in the window).  Has anyone had this issue -- I suspect this more of a stagewebview issue vs facebook?

 

...Jim

 

Please use plain text.
Developer
ChappyK
Posts: 75
Registered: ‎09-13-2011
My Device: Playbook
My Carrier: None

Re: Facebook integration error on login

I had a similar issue, to fix that I just made the popup window full screen. The keyboard pushes everything up in the webview but does a crappy job rerendering it and it all gets screwed up, in full screen it doesn't do that for some reason.


Show your support and click on the like button when you see a post that was helpful.
Please use plain text.
Regular Contributor
JimmyO
Posts: 93
Registered: ‎02-03-2011
My Device: Not Specified

Re: Facebook integration error on login

How do you make the popup window fullscreen?  The parameters in the rectangle in the following statement appear to be irrelevant when I run it on the PlayBook; the popup is always the same size.  I have tried changing the number of pixels, etc.

facebookWebView.viewPort = new Rectangle(0,0,stage.width,stage.height);

Please use plain text.
Developer
ChappyK
Posts: 75
Registered: ‎09-13-2011
My Device: Playbook
My Carrier: None

Re: Facebook integration error on login

this is what my login method looks like in FacebookMobile class

 

protected function login(callback:Function, stageRef:Stage, extendedPermissions:Array, webView:StageWebView = null):void {
			this.loginCallback = callback;
			this.stageRef = stageRef;
			if (!webView) {
				this.webView = this.createWebView();
				
			} else {
				this.webView = webView;
				this.webView.stage = this.stageRef;
			}

			this.webView.assignFocus();
			this.webView.viewPort = new Rectangle(0, 0, this.stageRef.stageWidth, this.stageRef.stageHeight);
			
			if (applicationId == null) {
				throw new Error(
					'FacebookMobile.init() needs to be called first.'
				);
			}

			loginWindow = new MobileLoginWindow(handleLogin);
			loginWindow.open(this.applicationId,
				this.webView,
				FacebookDataUtils.flattenArray(extendedPermissions)
			);
		}

 



Show your support and click on the like button when you see a post that was helpful.
Please use plain text.
Regular Contributor
JimmyO
Posts: 93
Registered: ‎02-03-2011
My Device: Not Specified

Re: Facebook integration error on login

Thank you for the help thus far.  

 

Now that I have facebook.login working, I am having problems with logout.  The issue occurs when Ia person is loggedin (using FacebookMobile.login(...)), then logs out (I call FacebookMobile.logout()) , and then the user presses a button to call FacebookMobile.login(...) again: the person who was previously logged in is *automatically* logged back in.  I would like it to permanently log the person out once they logout ... is there some sort of session information that is being retained that I need to delete when they log out?  This information appears to be retained even if they logout, close the app, restart the app and login.

 

 

 

Please use plain text.