04-03-2012 06:00 AM
Hello friends,
I ma new in integrating the facebook into the application.
So please make me step by step process to add the jar file and use it into the app.
I had already downloaded the jar facebook sdk and add it to my workspace but I did get way how to use it.
I am using Blackberry JDE 5.0 for development
thanks in advance.
04-03-2012 07:24 AM
below is the code i used for facebook integration in my app ... you can add the jar using add jar option in your project properties-> java build path -> libraries
private static String APPLICATION_ID = "";
private static String APPLICATION_SECRET = "";
private static User user;
private static String[] PERMISSIONS = Facebook.Permissions.ALL_PERMISSIONS;
private static Facebook fb;
static {
try {
accessToken = new StringBuffer(new HttpClient().doGet(
"https://graph.facebook.com/oauth/access_token?gran
+ APPLICATION_ID + "&client_secret=" + APPLICATION_SECRET).toString()
.substring(13));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}// =
}
ApplicationSettings as = new ApplicationSettings(NEXT_URL, APPLICATION_ID,
APPLICATION_SECRET, PERMISSIONS);
fb = Facebook.getInstance(as);
fb.setAccessToken(accessToken.toString());
try {
fb.getCurrentUser(new BasicAsyncCallback() {
public void onComplete(com.blackberry.facebook.inf.Object[] objects,
final java.lang.Object state) {
user = (User) objects[0];
StringBuffer post = new StringBuffer("");
post.append("hi:");
user.publishStatus(post.toString());
}
public void onException(final Exception e, final java.lang.Object state) {
e.printStackTrace();
exception = true;
Logger.getInstance().logInformationEvent("fb exception " + e.toString());
}
});
} catch (FacebookException e) {
e.printStackTrace();
exception = true;
} catch (Exception e) {
Logger.getInstance().logInformationEvent("fb exception " + e.toString());
}
04-03-2012 08:21 AM
Hello friend,
thanks again.But as i already mention that I am working over Blackberry JDE 5.0 so please support me over that thanks again
04-04-2012 02:31 AM
Hi Madiha
As you said I downloaded the jar files and added it to my project...
Now can you please explain me in detail the next steps to integrate facebook in my application
Thankx in Advance...................
04-04-2012 06:54 AM
Hello friends,
I had the same question for Blackberry JDE 5.0 .
thanks
in advance
regards
suraj
04-04-2012 06:58 AM
Just add a class in your project and the above code i provided (is for changing your status) then call it where you want
04-04-2012 07:24 AM
04-04-2012 08:42 AM
Helllo friends
I am getting the exception poped as screen.
message ="Classes are not found"
thnkas in advance
04-05-2012 01:05 AM
private static String NEXT_URL = "http://www.facebook.com/connect/login_success.html";
you can do srtandard http get request to the url ...
04-05-2012 01:10 AM