Advertisement
anta40

FacebookScreen.java

Mar 22nd, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. public class FacebookScreen extends MainScreen {
  2.  
  3.     private String APPLICATION_ID = "xxxxxxxxxx";
  4.     private String APPLICATION_SECRET = "xxxxxxxxxx";
  5.     private String NEXT_URL = "http://www.facebook.com/connect/login_success.html";
  6.     private String[] PERMISSIONS = Facebook.Permissions.USER_DATA_PERMISSIONS;
  7.    
  8.     public FacebookScreen(){
  9.         ApplicationSettings as = new ApplicationSettings(NEXT_URL, APPLICATION_ID, APPLICATION_SECRET, PERMISSIONS);
  10.         Facebook fb = Facebook.getInstance(as);
  11.        
  12.         try {
  13.             fb.getCurrentUser(new BasicAsyncCallback(){
  14.                 public void onComplete(com.blackberry.facebook.inf.Object[] objects, final java.lang.Object state) {
  15.                    
  16.                     User user = (User) objects[0];
  17.                     user.publishStatus("Facebook BB SDK testing"); 
  18.                 }
  19.                          
  20.                 public void onException(final Exception e, final java.lang.Object state) {
  21.                     System.out.println("FB Error: "+e.getMessage());   
  22.                 }
  23.            
  24.             });    
  25.         }
  26.         catch (FacebookException fbe){
  27.             System.out.println(fbe.getMessage());
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement