Can I access steps from S Health or Google Fit or some other app from Corona. Or make a step counter within Corona that would work while the screen is asleep? I would like to make a little pedometer based game.
Multiple questions in one post, so I’ll answer the one that is most relevant:
-
Corona SDK apps will not execute code when suspended. i.e. They do not run in the background or process system events.
-
When you suspend the device, the app suspends.
-
By screen ‘asleep’ you mean ‘off’ right? i.e. The device is hibernating/suspended. In any case, if the app is not in the foreground and visible it is not running.
Corona SDK does not have any API’s or any plugins that can count steps. However you do have access to the acceleromenter which gets you the raw data on the device’s movement and compute steps yourself, but this will only work while the phone is awake and the app is in the foreground. Corona SDK is not designed to run in the background. There is an assumption that there is a screen to draw to each frame.
We do have a product called Corona Enterprise that lets you talk to other native SDKs. You could use it to collect your native data and **in theory** have it run in the background and when the app wakes up, send the collected data to the Lua/Corona portion of the app to display.
I am not a math guy but pebble did publish thier algorithms to count steps which you should be able to use with corona with some modifications.
Multiple questions in one post, so I’ll answer the one that is most relevant:
-
Corona SDK apps will not execute code when suspended. i.e. They do not run in the background or process system events.
-
When you suspend the device, the app suspends.
-
By screen ‘asleep’ you mean ‘off’ right? i.e. The device is hibernating/suspended. In any case, if the app is not in the foreground and visible it is not running.
Corona SDK does not have any API’s or any plugins that can count steps. However you do have access to the acceleromenter which gets you the raw data on the device’s movement and compute steps yourself, but this will only work while the phone is awake and the app is in the foreground. Corona SDK is not designed to run in the background. There is an assumption that there is a screen to draw to each frame.
We do have a product called Corona Enterprise that lets you talk to other native SDKs. You could use it to collect your native data and **in theory** have it run in the background and when the app wakes up, send the collected data to the Lua/Corona portion of the app to display.
I am not a math guy but pebble did publish thier algorithms to count steps which you should be able to use with corona with some modifications.