Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to keep Codea app running in the background? GPS Logger.

Trying to make a simple GPS logger app. Problem is, when the app 'suspends' by pressing the home button or when the iPhone timeouts and returns to the lock screen, then it stops updating.

Does anyone know of a way to keep updating variables in the background?

The program below just prints a series of numbers, but they stop updating when the app 'suspends'

function setup()
print("Hello World!")
location.enable()
i=0
end

-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)

text("Latitude: " .. location.latitude,WIDTH/2,HEIGHT-HEIGHT/20)
text("Longitude: " .. location.longitude, WIDTH/2, HEIGHT-HEIGHT/20-HEIGHT/20)
text("Elevation (meters): " .. location.altitude, WIDTH/2,HEIGHT-HEIGHT/20*3)


print(i)
i = i +1
-- This sets the line thickness
strokeWidth(5)

-- Do your drawing here

end

Comments

Sign In or Register to comment.