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

Java Development

Reply
Developer
Posts: 239
Registered: ‎07-26-2010
My Device: Z10
My Carrier: Telkomsel

Cannot post status update to Facebook?

I'm trying to post status update to Facebook, using Facebook BB SDK (v0.8.25)

 

This is the code I use. Pretty much taken from the SDK

import com.blackberry.facebook.ApplicationSettings;
import com.blackberry.facebook.BasicAsyncCallback;
import com.blackberry.facebook.Facebook;
import com.blackberry.facebook.FacebookException;
import com.blackberry.facebook.inf.User;

import net.rim.device.api.ui.container.MainScreen;

public class FacebookScreen extends MainScreen {

	private String APPLICATION_ID = "xxxxxxxxxx";
	private String APPLICATION_SECRET = "xxxxxxxxxx";
	private String NEXT_URL = "http://www.facebook.com/connect/login_success.html"; 
	private String[] PERMISSIONS = Facebook.Permissions.USER_DATA_PERMISSIONS; 
	
	public FacebookScreen(){
		ApplicationSettings as = new ApplicationSettings(NEXT_URL, APPLICATION_ID, APPLICATION_SECRET, PERMISSIONS);
		Facebook fb = Facebook.getInstance(as);
		
		try {
			fb.getCurrentUser(new BasicAsyncCallback(){
				public void onComplete(com.blackberry.facebook.inf.Object[]	objects, final java.lang.Object state) { 
					User user = (User) objects[0]; 
					user.publishStatus("Hi, this is posted via Facebook BB SDK!");	
				} 
						 
				public void onException(final Exception e, final java.lang.Object state) { 
					System.out.println("FB error: "+e.getMessage());	
				} 
			
			}); 	
		}
		catch (FacebookException fbe){
			System.out.println(fbe.getMessage());
		}
	}
}

 Ran the code in simulator, and the output was blank white screen.

So I debugged it, and found this:

[0.0] 2013-03-13 10:32:13 [INFO] HTTP-GET (TCP Cellular):  https://graph.facebook.com/me?access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
[0.0] 2013-03-13 10:32:14 [INFO] HTTP-GET Response:  200 OK
[0.0] 2013-03-13 10:32:14 [INFO] HTTP-GET Body:  text/javascript; charset=UTF-8(2307)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LS:<-F
[0.0] VM:PISVt=0,h=1735,id=d15a33128dfbb5d9
[0.0] VM:LNTDa=commit,t=0,p=SeMar
[0.0] 2013-03-13 10:32:15 [INFO] HTTP-POST (TCP Cellular):  https://graph.facebook.com/1714093807/feed;dev[0.0] iceside=true
[0.0] 2013-03-13 10:32:15 [INFO] HTTP-POST Response:  403 Forbidden
[0.0] 2013-03-13 10:32:15 [INFO] HTTP-POST Body:  text/javascript; charset=UTF-8(0)

 HTTP-Post Response: 403 Forbidden

Maybe Facebook changed their API and somehow Facebook BB SDK is not up to date?

Highlighted
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Cannot post status update to Facebook?

Does StrawBerry - the sample app supplied with the SDK - work?