Jun 18, 2011

Facebook API ME for Blackberry

Hi, all

This afternoon, I released Facebook API ME v1.0 for Blackberry. This version uses BrowserField component from RIM API to display the authentication page. As I explained in this tutorial, to use the API for other platforms, you just need to work with the respective wrapper class for the target platform. Regarding Blackberry, you will have to use BrowserFieldAuthDialogWrapper.

...
BrowserField browserField = ...;

AuthDialogWrapper pageWrapper = 
    new BrowserFieldAuthDialogWrapper(browserField);
pageWrapper.setAppId("App Id goes here");
pageWrapper.setAppSecret("App Secret goes here");
pageWrapper.setRedirectUri("Redirect Uri goes here");
pageWrapper.setPermissions(new String[] {Permission.OFFLINE_ACCESS, Permission.PUBLISH_STREAM});
pageWrapper.addAuthenticationListener(this);
pageWrapper.login();
...

Besides the release package, there is also a sample app demonstrating how to implement the authentication process for this platform. Here it goes the download link.

I hope you guys enjoy it.

See you in the next post...

2 comments:

Ernandes Mourão Júnior said...

Hi,

Your app is responsible for closing the browser screen when it is flagged by the onAuthorize method call. As soon as you grab your token, close the browser. Just that! Facebook API is not supposed to have control of your app's flow.

Regards,

Ernandes Mourão Júnior said...

You are supposed to store the token before the app quits.