-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breaking change checked in for android plugin, JS and Java plugin do not work for android now. #438
Comments
@jackychow I tagged the previous stable https://github.com/phonegap/phonegap-facebook-plugin/releases/tag/0.4.2 please use that for now. This repo needs a develop branch badly... |
Also i'm not sure about your Android issue. The native parts all seem to work and have been tested by several developers. Can you list some more detail about the issues that you have? I'll take a look. JS update coming ASAP. Sorry for the breaking change (hence we tagged the previous code) |
I think the current master branch just wouldn't work on android at all. I'm speaking with reference to the "Simple" example which calls init on the CDV plugin. It will always come back as "Facebook Connect plugin fail on init" (refer to thread #343, which a number of people also reported the same issue). As I mentioned, this is due to the fact that init was not considered as a valid action in the plugin code you checked in on Feb 03 for ConnectPlugin.java. (you removed the condition, if (action.equals("init")) ). Unless there are other ways to init the plugin, I cannot see how this could have worked. Is the unit test not testing the hook between the JS code and the native code? Certainly, the native code itself might work, however, we cannot use it in Android because we cannot hook into the native code via the JS interface, and the two are just not working together. Again, if there are other ways that's supposed to init the plugin, I would appreciate some pointer to newer examples that would work. One more thing, in the "initialize" method in the native code, ConnectPlugin.java, I think line #55 would fail because "fb_app_id " does not exist in any of the string resource files, could probably update documentation if that's intended to be user added. Thanks, |
I have the same problem "Facebook Connect plugin fail on init" |
@jackychow The Facebook JS API has changed completely if you want to access native plugin code check the README.md. The old FB js-sdk needs an update and wrap around the new JS API to native. This is ongoing. There is also a large pull request for new Graph API for Android which is slowing progress on the js-sdk changes. |
Thanks @aogilvie. I still have a few questions, and if that's not too much to ask here.
Again, I understand the update and maintainence is on voluntary basis and I very much appreciate the works you've done for this. That said, given that the plugin has been working before, maintaining the status quo that it continues to work is very important for people who are using this in their production code. Thanks! |
No problem. I'll try answer you Q's as best as possible.
I tagged the old code if you need that. Trying to move quickly on this, also appreciate any testing you can do on PRs. Awesome FB plugin on it's way! 🍻 |
This is my observation, I'm looking at writing native unit tests for testing if we have all the same APIs. In the meantime, can you confirm, as I expect, we can remove the old stuff?? |
Sure I'll test the PR for android API and comment on the PR. Thanks for moving forward! I think the graph API would cover almost every operation that a user would want to perform. Here is my 5 cents on the new paradigm (using a new custom JS interface and ditch the FB SDK/CDV interface) though: One advantage (I don't know how significant it is) for using the FB's own facebook-js.sdk.js is the ability to use the same code on both browser and phonegap (we just need to initialize differently based on detecting if we are in phonegap or not). So for developers who are trying to support platforms beyond IOS/Android, this is probably important. For instance, they might choose to host code on a webserver for users with desktop/BB/WP systems ... with this new paradigm two completely different branches of code has to be written (and maintained) - One uses the new phonegap-fb-plugin and one uses FB's JS SDK. This would appear quite messy if the two code paths thing is the only solution to this problem. Also, using FB's JS SDK seems to have the additional benefit of saving the need to re-integrate new features of the API. Because as far as I know, the only reason we need to use native code in phonegap is login and logout because the whole cross site scripting prevention that FB requires us to put a requester IP when using the JS SDK to login. Once we are logged in, we can use FB's JS apis as-is. So hypothetically, FB revamp graph API a few months later and added something called X-API, then we would need to re-integrate X-API and expose that on the custom JS plugin script ... whereas, when FB release new SDK, they necessarily would have written a working X-API method in a distributed JS SDK. That said, using FB's distributed JS SDK has it's only problem too .... somebody need to update the JS SDK code regularly as the whole cordova nativeinterface patch has to be hacked in for this to work. |
by the way, forgive me for being dumb ... how do I get the code that you changed from the PR? I see the diffs but is there a branch that I can pull the changed files to test? |
Hi Ally, been away for a few days and just started picking up testing your new JS plugin. apparently this is giving me an unreference error for require. Do I need nodejs or commonjs to make this work? |
@aogilvie Could you please update the README with the new setup guide? |
@bsnkengs Latest README: https://github.com/aogilvie/phonegap-facebook-plugin/blob/backwardCompatUpdate/README.md @jackychow no need for node.js or common.js, but you must install with CLI. |
I read all the discussion and I tried different solutions but I still have the "Facebook Connect plugin fail on init". Now, I'm trying to use the new JS:
Now, how can I instantiate the facebookConnectPlugin object ? I tried: |
@Pyo25 If you are using the "cordova add" method, the JS libraries are loaded dynamically You can just reference the library, like: facebookConnectPlugin.login etc. You don't have to import anything |
@jackychow This issue is now fixed in develop branch. APIs should all be linked for JS, iOS and Android. I have also updated the Facebook JS SDK. |
@jackychow Can you check develop branch and tell me if this solves your problem? I'd like to try resolve this github issue. |
I'm closing this issue. @jackychow re-open it if you have difficulty with the new API. |
Hi, I believe @aogilvie checked in a breaking change to ConnectPlugin.java on Feb 03 in this change:
ee6c32d#diff-c25cdc153106f171cfa0c5fc8fdc1ffd
the condition in "execute" which handles "action.equals("init")" was removed but the JS plugin's init code is still calling cordova.exec with 'init' action. The repo for android as of this state does not seem to work because the plugin cannot initialize. Using an older version of ConnectPlugin.java seems to work but the old code apparently does not use the newer FB SDK and hence is filled with deprecated methods.
Can the changes be either rolled back or rolled forward for a permanent fix?
The text was updated successfully, but these errors were encountered: