Twitter, Facebook

Posting to SNS

https://www.kwiksher.com/tutorials/Kwik4/SocialCanvas.zip

if you have not done Canvas tutorial yet. See Canvas tutorial

This is experimental to send a screenshot to facebook or twitter Twitter and Facebook book Rest APIs are used. Please login each developer site to register apps.


Twitter

Go https://apps.twitter.com and click Create New App on the right hand corner

For instance, kwik Social Demo app is created, Callback URL is http://twitter.com/kwiksher

From Keys and Access Tokens Tab, you find Consumer key(API key) and Consumer Secret(API Secret) which are set in controller/twitter.lua


Facebook

Go https://developers.facebook.com/apps and Add a New App

Choose Website in Add a New App window

For instance, I created Kwik Social Demo. Settings Site URL is http://coronalabs.com/ You find App ID and App Secret which are used in contoller/facebook.lua


Adding External Code

In SocailNetwork Folder, you find the following folders and lua files. * lib/ * controller/ * main_code.lua * logout_code.lua * post_fb_code.lua * post_tw_code.lua

Open controller folder, and open twitter.lua and facebook.lua with a text editor. Let’s set the keys of twitter and facebook.

then copy lib and controller folders to the build folder.

Add Main.lua Externl Code from Project and Pages

Set main_code.lua

Now you can make twitter layer as a button with external code. Create twitter button with post_tw_code.lua

Now you can make facebook layer as a button with external code. Create facebook button with post_fb_code.lua

Now you can make logoutBtn layer as a button with external code. Create logout button with logout_code.lua

That’s all. Publish and you can test facebook and twitter post with corona simulator.