Gideros Share object provides a way to put share button for popular social portals in your Gideros app.

You can provide URL to your app website or market/appstore link and proposed title for your app users to share

Currently this class supports facebook and twitter. If you know or think that some other sharing service should be added to this class, let me know, and I'll add it. ;)

Package contains Share.lua and example Gideros application project.

Contents

Download

Example codes

--initilize Share
local title = "AppcodingEasy.com - Put Share button in Gideros app"
local url = "http://appcodingeasy.com/Gideros-Mobile/Share-button-in-Gideros-app"
local sharer = Share.new(title, url)

--create holder for button
--for easier positioning
local holder = Sprite.new()

--get all buttons
local buttons = sharer:getAll()

--add buttons to holder
for i,button in pairs(buttons) do
	button:setPosition(0, holder:getHeight())
	holder:addChild(button)
end

--positione holder in center
local hmiddle = (application:getContentWidth()-holder:getWidth())/2
local vmiddle = (application:getContentHeight()-holder:getHeight())/2
holder:setPosition(hmiddle, vmiddle)

--add holder to stage
stage:addChild(holder)

Example video

Video of class example app:

Method list

Constructor

Back to method list

Method namenew(title, url, config)
DescriptionCreate Share object with specified configurations
Input parameters

string title - title to share

string url - URL to share

table config - lua table with configuration:

  • string facebook - path to facebook button image (default: facebook.png)
  • string twitter - path to twitter button image (default: twitter.png)

Example input
Share.new("My title", "http://mydomain.con")

Get specific button

Back to method list

Method namegetButton(name)
DescriptionGet share button for specified portal
Input parameters

string name - name of the portal, currently supported values are:

All you need to do is add button to stage or scene and position it

Get all buttons

Back to method list

Method namegetAll()
DescriptionGet table with share buttons from all supported portals
Example output
{
	facebook = button,
	twitter = button
}

Latest changes

None for now