wizcorp / phonegap-facebook-plugin Goto Github PK
View Code? Open in Web Editor NEWThe official plugin for Facebook in Apache Cordova/PhoneGap
License: Other
The official plugin for Facebook in Apache Cordova/PhoneGap
License: Other
I'm getting the following error:
2011-08-16 10:39:23.301 MC02[1510:207] PGPlugin class FacebookConnectPlugin (pluginName: com.phonegap.facebook.Connect) does not exist.
2011-08-16 10:39:23.301 MC02[1510:207] ERROR: Plugin 'com.phonegap.facebook.Connect' not found, or is not a PGPlugin. Check your plugin mapping in PhoneGap.plist.
Here are a few screenshots:
http://j.mp/r8z0UL
http://j.mp/o36Y4I
I'm sorry to be this negative, but the facebook app secret "should not be shared with anyone or embedded in any code that you will distribute" (http://developers.facebook.com/docs/authentication/).
If I put it in my AndroidManifest.xml (as it is required by this plugin), it's not a big deal to recover it:
http://stackoverflow.com/questions/2097813/how-to-parse-the-androidmanifest-xml-file-inside-an-apk-package
Any plan on improving this ? I'm hesitating to use the plugin because of this.
I've tried everything I can think of. But can't get this thing to work. Is the App ID supposed to be string based or int?
FB.init({ appId: 19354053785, nativeInterface: PG.FB });
or
FB.init({ appId: "1935653785", nativeInterface: PG.FB });
Login button does nothing on emulator. On the real phone the facebook pages flashes briefly. Always just says not logged in. Me says {"message":An active access token must be used....
Thanks for any help.
I see several issues reported and i would like to know if somebody has this plugin running 100% with the lastest version of FB SDK and Phonegap.
I think this is the only plugin in the market to connect Phonegap and FB. Please let me know if somebody know any other solution.
When using this with current versions of the Facebook app on Android, everything is peachy. If the user doesn't have Facebook installed or has an old version installed (1.1.3) it does not work. It silently fails and returns nothing back to the PhoneGap JS application. No Exceptions are raised, no errors generated, nothing happens.
Any suggestions?
The this.facebook.authorize seems to be the culprit. It fails without error and the plugin seems to basically stop.
Platform: Android
I am new to mobile development. This issue might seem very basic but any help would be great.
I followed all the steps mentioned in the readme file to create the sample app. On executing the app, none of the buttons work or they say i am not logged in.
I also receive this message "{"message":"An active access token must be used to query information about the current user.","type":"OAuthException"}" on selecting "Me" button.
BTW, i am not getting any errors
When logging out, the key pg_fb_session isn't cleared from local storage. This means that if a user logs out, closes the app, then re-opens it, he's still logged in.
It's minor, but unexpected.
hello,
I got the plugin working so the app was able to allow users to post to their wall. I was able to post the user message as well as other parameters like description, etc.
The last time I tested this successfully was back in 10-2.
I just tested again today and only the user message will post successfully. All other parameters like "description" will not go through. I did not change any configuration on my side. I added the external host "graph.facebook.com" in phonegap.plist but still the same problem.
Did facebook change their api methods?
Any help would be greatly appreciated.
I'm using phonegap 1.0, xcode 4.0.2
Here's my code for the fb.api call:
/////
var publish = {
method: 'stream.publish',
message: 'hi',
picture : '',
link : 'http://www.google.com',
name: 'name',
caption: 'caption',
description: 'testing description',
};
FB.api('/me/feed', 'post', publish, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
From the readme:
"The working version of the Facebook Android SDK is distributed with the plugin ..."
Does "the plugin" above mean this plugin? This plugin's source doesn't have
native/android/src/com/facebook/android/. Do you mean to get it from Facebook?
Cheers,
Libby
I'm not sure if this is an issue with the plugin, the facebook SDK, or the facebook API. When I do login I get back a response with a session that has an access key and a secret, but "..." for the uid value.
Screenshot: http://dl.dropbox.com/u/10998095/Screenshots/7m.png
The code:
FB.login(function(response) {
if (response.session) {
alert(JSON.stringify(response.session));
alert(JSON.stringify(FB.getSession()));
} else {
alert('No session found?');
}
}, {perms: 'user_birthday,email,user_location'});
I've tried with multiple facebook accounts, and tried on both the emulator and phone, and tried with both the facebook app and the m.facebook.com login. I would like to print out the returned JSON to ensure it's not a deserialization problem, but I'm not familiar enough with Objective C to do that.
Thanks!
Hello Dave,
Thanks so much for putting this up here. I'm having a problem and if you can point me in the right direction, I'll jump in and see if I can help fix it. When running the provided example, I'm getting the following error:
2011-08-16 08:34:09.176 PhoneGapFacebookConnect[3763:307] PhoneGapDelegate::shouldStartLoadWithRequest: Received Unhandled URL about:blank
2011-08-16 08:34:09.194 PhoneGapFacebookConnect[3763:307] Ignoring gap command with incorrect sessionKey; expecting: 1495906917 received: (null)
2011-08-16 08:34:09.197 PhoneGapFacebookConnect[3763:307] Complete call: gap://com.phonegap.facebook.Connect.init/com.phonegap.facebook.Connect.init0/188240441228254
Is there some setting that needs to be adjusted on the example app?
Thanks in advance.
It can be from using JSONKit
Here are some logs:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<NSConcreteMutableData 0x656f970> valueForUndefinedKey:]: this class is not key value coding-compliant for the key id.'
NSDictionary* session = [NSDictionary
dictionaryWithObjects:[NSArray arrayWithObjects:self.facebook.accessToken, [self.facebook.expirationDate description], APP_SECRET, [NSNumber numberWithBool:YES], @"...", [result valueForKey:@"id"], nil]
forKeys:[NSArray arrayWithObjects:@"access_token", @"expires", @"secret", @"session_key", @"sig", @"uid", nil]];
NSDictionary* status = [NSDictionary
dictionaryWithObjects:[NSArray arrayWithObjects:@"connected", session, nil]
forKeys:[NSArray arrayWithObjects:@"status", @"session", nil]];
I have implemented step by step the PG FB plugin, when I run it on android device with the facebook app installed on it there are no problems. When the login button is tapped it switches to FB app and everything is working as expected. However if I try to use it without the FB app installed on the device when the login button is tapped nothing happens. There is nothing in the error log.
As far as I searched the property
nativeInterface: PG.FB in the FB.init({ appId: "xxx", nativeInterface: PG.FB });
is responsible for the call to the native FB app. I tried removing it ( like FB.init({ appId: "xxx" }); ) and expected to be redirected to the touch FB site or something like this.
The result was that it opens an error facebook page with the following information:
An error occured with ..... Please try again later.
API Error Code: 191
API Error Description: The specified URL is not owned by the application
Error Message: redirect_uri is not owned by the application.
I'll appreciate any help :)
Thank you
forgot to mention:
PhoneGap: 1.2.0
Testing device: Android 2.3.3
Maybe my understanding of Objective C is just terrible, but is there a simple way to force this pluggin to use the ChildBrowser plugin and not the native browser app for authentication? I'm trying to keep from switching apps as much as possible.
If this already exists, my apologies, I was just unable to figure it out by reading the src and examples.
Hi Dave,
Just found out phonegap official FB plugin days ago, was trying out the sample index.html. I tried it on my phone( android 2.3.3) and also the virtual device on eclipse (phonegap version 0.9.5). Problem is when i clicked on either of the button "Login" "Me" "Get Session" "Get Login" "Logout" seems like there arent any response, seems like there is nothing going on back there. Apart from that, the ConnectPlugin.java file is having this error - "The method setActivityResultCallback(ConnectPlugin) is undefined for the type PhonegapActivity", You mentioned the dialog feature wasnt support in this version of the plugin, were u referring to this error? Please advise, many thanks
Lawrence
Hey,
I'm going back and forth between this and the solution offered by childBrowser/FBConnect. I just got the latter working earlier today, thanks to shazron.
In both cases though, if I choose "Don't Allow" for the facebook app, I'm returned to a blank screen in the phonegap app. I'm kind of at loss for what to do. Any idea?
First, this plugin rocks! it was super easy to integrate with my existing app and saved me a ton of time.
So Thank you!
Anyways, It seems like every time I completely close the app (using ios taskbar) and restart, I have to login into fb again.
Is there a way to keep the app loged in?
Hello there,
I'm trying to get the Android sample working on an emulator with version 2.1 and on an actual device with 2.3.3.
I've done the setup and library arrangement as it was written in the guide.
When i click the buttons i'm getting problems on both of them and get session returns null.
The error which i'm getting at the emulator is .
facebook_sdk_js : Line 70 : FB Login () called before FB Init()
The error at the real device is quite different which is.
Failed to find provider info for com.facebook.katana.provider.FriendsProvider
I'm struggling to work this out hope someone can lend a hand soon.
Thanks
Hello all,
I am trying to connect to facebook through html, css made android application. I used this plugin (https://github.com/davejohnson/phonegap-plugin-facebook-connect) for this . I followed all instruction give in read me and used the same example what is given in git folder without making any changes. Then when i run it on android phonegap emulator, buttons are not responding. When i tried this on web-browser, it is showing the error FB.login() called before calling FB.init().". I dont know why this is coming. My main task is to post on wall from my web-based android application.
Please kindly help me to implement this.
Thank you in advance.
My App has been working happily on iOS for weeks now but as of today when trying to log in i get the following error on the permissions screen:
API Error Code: 100
API Error Description: Invalid parameter
Error Message: Requires valid redirect URI
Is anybody else having the same issue?
Thanks
I have not been able to successfully build a project using PhoneGap 1.1.0 or 1.0.0 in Xcode 4.2. Has anyone had any luck with PG 1.1.0 and Xcode 4.2? Also, it is not clear if this plugin works beyond PG 1.0.0.
I'll update this issue with more specific errors later. If anyone has remarks in the meantime, please share.
Best,
J.Schwartz
Hi,
I used the phonegap-plugin-fb to connect my application to FB and it worked great (with android).
Now, I want to publish a predefined message to the user's wall.
Is there a method for it or someone could help me please?
thx
Check line 126 in FacebookConnectPlugin.m and see where I was going with that.
Can I keep using the "Phonegap Build" (https://build.phonegap.com/) if I use this plugin in my application or I will have to compile separate versions?
After migrating to 1.1 the plugin stopped working due to SBJSON error.
I tried to use PG_SBJSON instead with no luck, however other plugin worked with PG_SBJSON.
It seems the facebook sdk is dependent on SBJSON.
Not deleting the JSON reference from the plugin directory didn't help as well, it will cause duplicate errors while building, i am not sure what is the right solution for this.
Hi guys,
Windows users have to be careful about openssl-for-windows (http://code.google.com/p/openssl-for-windows/downloads/list), the latest version, at least on plataform 64bits, don't generate the correct hash that Facebook need it for android apps.
When we are using this plugin we need provide a security hash to the facebook, in our aplication page (https://developers.facebook.com/apps), if what i'm saying don't make sense for you I recomend you read these materials:
http://developers.facebook.com/docs/mobile/android/build/#sig
http://developer.android.com/guide/publishing/app-signing.html
If you've read these materials and already know how works and how you will have to do to generate your security hash to use this plugin, remember of this tip:
Use one of this versions: openssl-0.9.8e_X64.zip or openssl-0.9.8d_X64.rar
You should not use the openssl-0.9.8k_X64.zip.
I hope this tip be useful. I lost a lot of time, testing ways to generate the correct hash and in the end the problem was with the latest version of openssl.
I have implemented the steps..I can able to view the buttons in simulator but can't able to login to facebook .when I click on Login button it doesnt seems to initialize Fb.login ..
Hello guys,
I was able to build an app using android and this plugin with phoneGap1.1.0, but on iOS after solving the SBJson Issue with the apropriated code the plugin doesn't work, i have tried with the sample provided with the plugin package.
In iOS also, the phonegap deviceready event, is not dispatched as in android.
Hello,
I followed all the instructions of how to use this plugin, i got my android hash key from my keystore and added it on facebook and installed my app's apk. Once i call FB.login i am redirected to a page on facebook where it says:
"Sorry, something went wrong."
"We're working on getting this fixed as soon as we can."
What am i doing wrong here?
With PhoneGap 1.2 IOS, when BOTH Facebook Connect and ChildBrowser plugins are installed, when initializing FB plugin by calling FB.init, an empty childbrowser window is launched. It can be closed manually and then everything works are expected. Note that the ChildBrowser plugin has not been initialized at this point.
I'm not seeing this issue with Android.
We won't have to worry about the duplicate symbol problem since this commit: https://github.com/phonegap/phonegap-iphone/issues/254
Will be in 1.1
Followed your instructions but keep getting compilation errors:
FBRequest.m:183: error: 'SBJSON' undeclared (first use in this function)
JBSON.h & JBSON.m are located in the Facebook-ios-sdk/FBConnect/JSON sub-folder.
Any advice
I got some problems when i try to install the plugin to my application im new with android developerment and phonegap so i think its some form of newbie misstake :)
Please check the screenshot for errorlog.
http://cl.ly/2R3b3Z1c0C2O1d2y1I19
HI
Any boby please help me through it. Login button doesn't work .
I can connect through the browser in the simulator perfectly fine, but i can't connect on the device using the native FB app. Attempting to login opens up the native app, but my app is reactivated before asking for permissions. Any help?
On iOS 4.2.1 (iPhone 3GS), the Facebook API shows an in-app dialog for login.
However, the results of this do not seem to be handled properly. While logins that use a URL-scheme callback seem to be handled fine, the login data for old platforms seem to go nowhere.
Looking at old commits seems to suggest this bug popped up around cf2a115, but (partly) reverting this commit did not solve the problem for me.
Some suggestions based on my experience of following the readme:
I couldn't build at Step 7 due to not having the Facebook SDK, so I went on to next step. Not sure what Step 7 was meant to do.
For step 8, URL scheme, I think you only need URLSchemes, not URLName (I looked at FB docs and thats what they did).
For Step 9, for getting the SDK at the suggested hash, these are the git commands I used:
git clone git://github.com/facebook/facebook-ios-sdk.git facebook-ios-sdk
cd facebook-ios-sdk/
git reset --hard 91f256424531030a454548693c3a6ca49ca3f35a
For steps 10-18 I ended up getting the FB SDK in a different way, as there seemed to be issues with the suggested way of doing it in the xCode I was using (http://stackoverflow.com/questions/7489597/why-cant-i-drag-the-facebook-sdk-into-a-new-project). I had to just manually add the FB SDK files to Classes.
After getting it running and seeing whitelist rejection warnings, I added facebooks URLs to the ExternalHosts in the plist-
graph.facebook.com*
api.facebook.com*
I had this issue after updating to the last version of the plugin. Found the solution here :
if ((session = JSON.parse(localStorage.getItem(key))) &&
session.expires > new Date().valueOf()) {
becomes
if (localStorage.getItem(key) != null && (session =
JSON.parse(localStorage.getItem(key))) && session.expires > new
Date().valueOf()) {
thanks!
I just added the plugin to my Android app. When i press on my "Login" button then i'm redirected to the Facebook login page.
In there i login with my Facebook account, hit the Login button and it then redirects me back to my app. So far so good...
But when i press on the button "Get Status" (which calls getLoginStatus()), then i get "Not logged in" back...
When i open the real facebook app then it knows that i'm logged in So my session must be stored somewhere.
Any idea why my Android app can't tell if i'm logged in??
Hi Dave,
I'm trying to integrate your facebook plugin. However, I am getting the same error as was mentioned in issue #51
When I click login, everything looks alright, no errors. However, when I try to click me, I get:
"{"message":"An active access token must be used to query information about the current user.","type":"OAuthException"}"
I have tried to deploy with phonegap 1.1.0 and 1.0.0 too.
Do you know what could be a problem?
Thank you for your help.
Regards
Lubo
Login button does not works. I am not receiving any js errors.
I have tried. to alert the values in phonegap-1.1.0.js
PhoneGap.exec = function(success, fail, service, action, args) {
alert(action);
try {
var callbackId = service + PhoneGap.callbackId++;
if (success || fail) {
PhoneGap.callbacks[callbackId] = {success:success, fail:fail};
}
var r = prompt(PhoneGap.stringify(args), "gap:"+PhoneGap.stringify([service, action, callbackId, true]));
alert(r);
for action:getconnectioninfo I am getting the value for r as empty. as well as for init action.
I'm attempting to export the data from an HTML5 canvas (either as a data URL or a blob) and post it to facebook.
var bytes;
canvas.toBlob(function(blob){ bytes = blob; });
var body = 'Test';
FB.api('/me/photos', 'post', { name: body, picture:bytes }, function(response) {
if (!response || response.error) {
alert(response.error);
} else {
alert('Post ID: ' + response.id);
}
});
} else {
alert('not logged in');
}
},
{ perms: "email, publish_stream" }
);
I'm receiving an error: 'com.phonegap.facebook.Connect2 = TypeError: 'undefined' is not an object'
Unfortunately the graph API seems to be horribly documented....so I'm not sure where to go. I'm able to upload a photo by simply passing a URL, but using a data url or a blob results in this error. Any ideas?
iam getting this error when i try to connect to facebok.
/Users/bridge/Desktop/ProjectIPhone/myTesting/myTesting/src/FBRequest.m:183: error: 'SBJSON' undeclared (first use in this function)
/Users/bridge/Desktop/ProjectIPhone/myTesting/myTesting/src/FBRequest.m:183: error: 'jsonParser' undeclared (first use in this function)
can any one give me a demo xcode project for phonegap-plugin-facebook-connect ?
As others have posted elsewhere, could only get this to work by downgrading to PhoneGap 1.0.0 (can find and install from github tag). With 1.1.0 could get it to compile, but then it wouldn't link properly, failing with:
Undefined symbols for architecture i386:
"OBJC_CLASS$_Facebook", referenced from:
objc-class-ref in FacebookConnectPlugin-375760CB59A4DB21.o
(maybe you meant: OBJC_CLASS$_FacebookConnectPlugin)
ld: symbol(s) not found for architecture i386
even though using lipo command line tool showed the .a file was i386 and nm command showed that symbol, and had several more experienced iOS developers look at it to verify was building and linking properly.
Hey guys,
I'm trying to use the plugin. The main flow of first time use works well. I'm able to log in, then make API calls (e.g. FB.api('/me') and so on).
However, when I reopen the app, the call to FB.init() doesn't seem to restore the session properly.
I've narrowed it down to the fact that the session I'm getting back from Facebook specifies the "expires" as a date string, rather than a unix timestamp (integer).
Therefore the session is never restored properly. See this part of the plugin's init():
if (session && session.expires > new Date().valueOf()) {
FB.Auth.setSession(session, 'connected');
}
The following returns false, of course: "2011-12-10 21:00:01 +0000" > new Date().valueOf()
:-)
My feeling is that this is caused by an incorrect settings on my Facebook app. I've tried to enable and disable "Upgrade to Requests 2.0", I've also made sure to keep old APIs available ("Remove Deprecated APIs" Disabled). I'm running out of ideas.
Did anyone encounter that problem? Can anyone offer suggestions to fix this?
Thanks in advance!
Mat
Note: I've made sure to use the older version of the FB SDK for iOS (commit 91f256424531030a454548693c3a6ca49ca3f35a), as suggested. I'm not removing the JSON code, as suggested in pull request #67.
I have this plugin installed and working for iOS 4.3 in the simulator (sans facebook app,), but when published to a phone with Facebook app installed, authorization switches to a Facebook page displaying "The page you requested was not found".
I'm digging into this now but thought I'd post in case anyone had run into the same issue.
None of the buttons do anything in the sample code except "Get Session", which returns NULL, regardless of whether or not you are logged into Facebook. Have tried phones with Android 2.2, 2.34, and tablet with 3.1.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.