Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
swati-srivastava
Posts: 282
Registered: ‎02-25-2010
My Device: curve,bold,storm

Connect to facebook api in blackberry

Hey can anybody tell me how to do facebook integration in my app

 

i tried using graph api but couldnt understand the urls and the methods need for login and posting data on wall

 

I tried to connect using HttpClient object using post data but it always shows error

 

can anybody explain how to call these api

actually i cant figure out the urls for this purpose

 

I have Api_key,Api_secret & Application_Id available with me.

 

I dont want to invoke browser for this purpose.

 

I have a screen where user enters username,password,comment to post on wall

When he clicks on OK button then first he should be authenticated then comment should be posted on wall.

 

thanx in advance

Developer
swati-srivastava
Posts: 282
Registered: ‎02-25-2010
My Device: curve,bold,storm

Re: Connect to facebook api in blackberry

i found an sdk here

 

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

 

but how to use that bunch of code?????

 

Developer
titakalpesh
Posts: 203
Registered: ‎07-30-2009
My Device: Bold(9780),Curve(8520)
My Carrier: Vodafone

Re: Connect to facebook api in blackberry

Hi,

 

i'm also try to run this code but not gettting the sessionkey from face book so if anybody have any idea please help us to do this.

 

Thanks In Advanced

Kalpesh

Developer
swati-srivastava
Posts: 282
Registered: ‎02-25-2010
My Device: curve,bold,storm

Re: Connect to facebook api in blackberry

i added the packsges but i get blank white screen and nothing in response

 

what to do????

 

i also tried this:

 

.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           

Developer
lynxgeek
Posts: 272
Registered: ‎05-24-2010
My Device: DEV Alpha C & BB 9720

Re: Connect to facebook api in blackberry

once try this url

 

 

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"
                    );

 

 

you should append the connection parameter to this string then it will work

Developer
lynxgeek
Posts: 272
Registered: ‎05-24-2010
My Device: DEV Alpha C & BB 9720

Re: Connect to facebook api in blackberry

one more thing is you cannot use your own login page to connect to facebook..

 

the url you menstioned will redirect you to facebook login page..

 

after successfull login.

you will get the session key and auth_token..

 

so that u can do further action

 

thanks regards yakub pasha

Developer
swati-srivastava
Posts: 282
Registered: ‎02-25-2010
My Device: curve,bold,storm

Re: Connect to facebook api in blackberry

hello  

 

 

 

Developer
swati-srivastava
Posts: 282
Registered: ‎02-25-2010
My Device: curve,bold,storm

Re: Connect to facebook api in blackberry

i dont have result token also

how to get that???

Developer
lynxgeek
Posts: 272
Registered: ‎05-24-2010
My Device: DEV Alpha C & BB 9720

Re: Connect to facebook api in blackberry

can u tell me wat type of connectio u have

 

are u using wifi or mds

Developer
lynxgeek
Posts: 272
Registered: ‎05-24-2010
My Device: DEV Alpha C & BB 9720

Re: Connect to facebook api in blackberry

 

public static String getConnectionPerameter() {
		String connectionParameters = "";
		if (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED) {
			// Connected to a WiFi access point
			connectionParameters = ";interface=wifi";
		} else {
			int coverageStatus = CoverageInfo.getCoverageStatus();
			ServiceRecord record = getWAP2ServiceRecord();
			if (record != null
					&& (coverageStatus & CoverageInfo.COVERAGE_DIRECT) == CoverageInfo.COVERAGE_DIRECT) {
				// Have network coverage and a WAP 2.0 service book record
				connectionParameters = ";deviceside=true;ConnectionUID="
						+ record.getUid();
			} else if ((coverageStatus & CoverageInfo.COVERAGE_MDS) == CoverageInfo.COVERAGE_MDS) {
				// Have an MDS service book and network coverage
				connectionParameters = ";deviceside=false";
			} else if ((coverageStatus & CoverageInfo.COVERAGE_DIRECT) == CoverageInfo.COVERAGE_DIRECT) {
				// Have network coverage but no WAP 2.0 service book record
				connectionParameters = ";deviceside=true";
			}		}
		return connectionParameters;
	}

	/**
	 * Reading the service record for available connection
	 * 
	 * @return ServiceRecord Currently in use
	 */
	private static ServiceRecord getWAP2ServiceRecord() {
		ServiceBook sb = ServiceBook.getSB();
		ServiceRecord[] records = sb.getRecords();

		for (int i = 0; i < records.length; i++) {
			String cid = records[i].getCid().toLowerCase();
			String uid = records[i].getUid().toLowerCase();
			if (cid.indexOf("wptcp") != -1 && uid.indexOf("wifi") == -1
					&& uid.indexOf("mms") == -1) {
				return records[i];
			}
		}
		return null;
	}