I was wondering if it were possible to develop a social media app in Codea? If it is possible, how would you push information to a server and retrieve that information?
The only way (without writing your own addon) would be through the http request functionality.
http.request functionality would likely be fine for a social media app. All you need is a server
@TechDojo and @JakAttak I don’t know much about servers, but do you guys have any recommendations on how I would make the server work? I just want to experiment with making a simple demo in which I can post text on the app and retrieve the text when I run the app, but the major problem is I don’t know how to set up a server like that.
I have wondered about this also, like would it be possible to make an Instagram? Twitter? Pinterest?
If you want to make a social media app that works with your website, you’re going to have to learn a lot of PHP.
@CodeaNoob Here’s the original post: http://codea.io/talk/discussion/3111/simple-instagram-popular-viewer
And here’s the code (Made by @Briarfox, not me)
-- Instagram
-- Use this function to perform your initial setup
displayMode(FULLSCREEN)
function setup()
instagram = {}
images = {}
colCount = 1
x = 90
y=HEIGHT-80
finished = false
getPopular()
getPopular()
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50,255)
displayImages()
end
function touched(touch)
if touch.state == ENDED then y = HEIGHT - 80 getPopular() getPopular()end
end
function getPopular()
finished = false
images = {}
local clientid = "2101a06164e04b60b1ace551b8d1a6a8"
local url = "https://api.instagram.com/v1/media/popular?client_id="..clientid
http.request(url,function(d)
print("Entered callback")
instagram = json.decode(d)
loadImages()
end,function(d) print(d) end)
end
function loadImages()
for i=1,#instagram.data do
if instagram.data[i].type == "image" then
local url = instagram.data[i].images.thumbnail.url
http.request(url,function(d)
local tmp = {user = instagram.data[i].user.full_name,id=d}
table.insert(images,tmp)
end)
end
end
finished = true
end
function displayImages()
local width = math.floor(WIDTH/160)
for i=1,#images do
if i > 24 then
--do nothing
else
sprite(images[i].id,x,y)
fontSize(14)
text(images[i].user,x,y-85)
end
x=x+160
colCount = colCount + 1
if colCount > 6 then y=y-170 colCount= 1 x = 90 end
end
colCount = 1
y=HEIGHT-80
x=90
end
It also requires a JSON library as a dependency, found here: https://dl.dropboxusercontent.com/s/9e4nvqeu4hsux2q/Json.lua?token_hash=AAFyMB98j4bnt_1gawf9wSke52hsoC7hsIvARcTuZNeOEw&dl=1
Thanks. I think I’m going to try to make the app in Xcode and use Parse.