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...

5 comments:

Unknown said...

its giving a problem while doing the same.

when it logged in successfully, it display page showing "authorization granted , close this page" but with no navigation option. also when i try to use onAthorize method, its token remains null .

i am just running the sample code itself, but its not luck there

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,

Unknown said...

ok but after closing the app, i wont be able to get access token, as onAthorize always being passes with null .

Ernandes Mourão Júnior said...

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

Unknown said...

onAuthorize(String token){
// when i check here putting break point , token is null
}