Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local facebook = require "facebook"
- -- You must use your own app id for this sample to work
- local fbAppID = "fb342224545897895" --fake
- local function onLoginSuccess()
- -- Upload 'iheartcorona.jpg' to current user's account
- local attachment = {
- message = "My score on Manic RowBuster.",
- source = { baseDir=system.ResourceDirectory, filename="myFame.jpg", type="image" }
- }
- facebook.request( "me/photos", "POST", attachment )
- end
- -- facebook listener
- local function fbListener( event )
- if event.isError then
- native.showAlert( "ERROR", event.response, { "OK" } )
- else
- if event.type == "session" and event.phase == "login" then
- onLoginSuccess()
- elseif event.type == "request" then
- native.showAlert( "Success", "The photo has been uploaded.", { "OK" } )
- end
- end
- end
- -- photo uploading requires the "publish_stream" permission
- facebook.login( fbAppID, fbListener, { "publish_stream" } )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement