Connect to facebook api in blackberry

2019-01-29 13:29发布

问题:

i found an sdk here:

http://www.baskoro.web.id/facebook-connect-blackberry-HOWTO.html

i tried to run the code both on device and simulator but it shows only white screen and nothing else

i also tried this without result token:

.append("&next=http://www.facebook.com/connect/prompt_permissions.php?api_key=" + "api_key" + "&display=popup&v=1.0&next=http://www.facebook.com/connect/login_success.html?xxRESULTTOKENxx&fbconnect=true&ext_perm=read_stre...")

but no success

i also tried this without result token:

StringBuffer url = new StringBuffer() .append("http://m.facebook.com/login.php?") .append("api_key=") .append(facebookFacade.getApplicationKey()) .append("&connect_display=page") .append("&v=1.0") .append("&fbconnect=true") .append( "&next="http://www.facebook.com/connect/login_success.html?xxRESULTTOKENxx&fbconnect=true" );

i dont have result token how to get that????

Plzzzzzzzz help

回答1:

Please use the latest SDK at here instead. You should be able to follow the short tutorial on the same page as well.



回答2:

Download graph api from http://sourceforge.net/projects/facebook-bb-sdk/. After that you have to add two thinks.

one is when you want to post a photo to your friends wall ,you have to put one more key-value in the JSONObject(Request) - that is requestObject.put("target_id",getid()) in publisePhoto method facebookuser.java & facebook.java

Second is you have to change JSONObject responseObject = fb.write(getId() + "/photos", requestObject, pPhoto.getMIMEType(), imageData, true);

to

JSONObject responseObject = fb.write(getId() + "/photos?access_token="+Facebook.token, requestObject, pPhoto.getMIMEType(), imageData, true);in FacebookUser.java & Facebook.java

where token is Static string from Facebook.java and store the value of access_token (you have to add it)



回答3:

i think before you start with sample codes. you need to study some of the links.

  1. OAuth 2.0

  2. facebook developer documents

after that you can get

client_id and client_secret from this link