Page 1 of 1

Facebook Like 'verified'

Posted: Sat Mar 05, 2016 8:16 pm
by Bruce Stuart

Good morning Appery team,

I've done some digging around on old posts - and found code to do a 'Facebook' like....

I've simply added this code (found in an old post) to an HTML element - and - it works great.... (the like is to like my client's facebook page)...

// -- iframe src="http://www.facebook.com/plugins/like...." scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:45px; width:200px;" allowTransparency="true"--/iframe--'

Replace my -- with '' as needed

The buttons will also do a share - which is great.

However, like most clients - we'd like to offer people who like us - an incentive, so we'd like to go out to facebook and validate that they've in fact liked us - before we post a credit to their account....

SO! - I've found a plugin to do this work:

https://github.com/Wizcorp/phonegap-f...

And the lookup process - and receipt of the data is described here:

https://github.com/Wizcorp/phonegap-f...

just a few lines down....:

When you display your page / button you have to call the getLoginStatus method first to know if the current user is connected to its Facebook account. If he is connected then call GET https://graph.facebook.com/me/og.like... with the Facebook Access Token returned by the getAccessToken method (if this returns data then style your like button with a red heart for example, a grey heart if the call returns an empty array).

So - I know you folks will not normally support plugins - but - I think the process of posting a like - and then ensuring the user has indeed liked it - is reasonably publicly needed here - so I thought I'd ask.

The gotcha is during install of this plugin - I get this error:

====================================================
Failed to install 'com.phonegap.plugins.facebookconnect':Error: Variable(s) missing: APP_ID, APP_NAME
at /usr/lib/node_modules/plugman/node_modules/cordova-lib/src/plugman/install.js:324:23
at fulfilled (/usr/lib/node_modules/plugman/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/usr/lib/node_modules/plugman/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/usr/lib/node_modules/plugman/node_modules/q/q.js:749:13)
at /usr/lib/node_modules/plugman/node_modules/q/q.js:557:44
at flush (/usr/lib/node_modules/plugman/node_modules/q/q.js:108:17)
at process.tickCallback (node.js:442:13)

stderr: Variable(s) missing: APP_ID, APP_NAME

====================================================
.
The docs for the plugin address this by telling you:

To install the plugin in your app, execute the following (replace variables where necessary):

Create initial Cordova app

$ cordova create myApp
$ cd myApp/
$ cordova platform add ios

The path you cloned the plugin to earlier Remember to replace APP_ID and APP_NAME variables

$ cordova -d plugin add /path/to/cloned/phonegap-facebook-plugin --variable APP_ID="123456789" --variable APP_NAME="myApplication"

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Is there any way to address this prior to installation in Appery in the source?? or does this error make the plugin - non-usable from Appery??

best,

Bruce


Facebook Like 'verified'

Posted: Sun Mar 06, 2016 7:36 pm
by Serhii Kulibaba

Hello,

We don't have an example how to use facebook like button in your app. But you can find solutions online, e.g.: http://stackoverflow.com/questions/23...


Facebook Like 'verified'

Posted: Sun Mar 06, 2016 10:50 pm
by Bruce Stuart

Sergiy,

The question is not how to use or create a facebook like button in my app. I've solved that.

The question is - when I implement a particular plugin - it errors out - a compile error - as it is insisting that the install process do a global variable replace - how do I do that global replace - noted above in the docs - to prevent the error during compile.

Please advice?

Bruce


Facebook Like 'verified'

Posted: Mon Mar 07, 2016 4:04 pm
by Bruce Stuart

for anyone following this - in order to bring this plugin into your App. - simply - after you've loaded the plugin via resources - you then need to add it to your app. Once that's done - then add the parameters APP_ID and APP_NAME like such:

Image

Be sure to replace your App_ID from Facebook developers dashboard, and your APP_NAME with your app_name from the dashboard.

Bruce


Facebook Like 'verified'

Posted: Mon Mar 07, 2016 7:59 pm
by Serhii Kulibaba

Do you need further assistance?


Facebook Like 'verified'

Posted: Tue Mar 08, 2016 1:16 am
by Bruce Stuart

Sergiy,

No - my app now compiles without error on this front.

Thanks!
Bruce


Facebook Like 'verified'

Posted: Tue Mar 08, 2016 6:54 am
by Bruce Stuart

FYI - when I complete this process - I'll post the 'tutorial' on how to create a page with a Facebook like - and the code to validate they liked it - along with the posting of a credit for doing so....