Running other code in background

Hello,

I asked a question a while back about running Corona in the background which I know cannot bve done. Someone replied saying I could call some other code to run in the background. Just like many others I need to write an app that will run in the background and capture the GPS locations and post to my server. Someone said that I can have some other type of code (not sure of language) be called to do this part for me. Then I can just use the corona app to handle everything else which would mainly be the settings for the app.

I need to do this for Android and iOS. So can thisd be done? What language would the other code be in? And last, I need this to start when the phone device is turned on. Can that still be done?

Thanks,

Warren

I’m not an enterprise user but if I were writing code to do that I might use coroutines to get some of the work done. I know the network request code runs asynchronously, so that can be used to send values to a server in the background, as long as the initial request is small enough.

You will not be able to have your code fire up when the device turns on. That sounds shady as hell, too. Why are you trying to do that? Android probably lets you do it but iOS definitely will not, thankfully.

@WarrenW, you can indeed create code that would run in background. The only limitation is that the code be created using native language (Java or Obj-C/Swift). 

Corona being OpenGL and all expects an functioning user interface running in the foreground. Any Corona Lua based API call’s behavior while background is untested, unknown and unsupported. It might work this release but not work on future releases and we have no plans to. I’ve heard of people on iOS getting an app backgrounded and getting GPS data. I’ve never heard of anyone getting it backgrounded on Android.

Now if you can build an Enterprise app that can be backgrounded and can collect your GPS data without needing to talk to the Corona/Lua side until it foregrounds itself, then you might find some success.

Rob

One non-shady example I can think of would be a running app. As a user I’d want to record the GPS data as I go, but I wouldn’t want to leave the app open as it would drain the battery. I’m sure there are plenty of other “safe” app ideas that would need to access GPS in the background.

I’m not an enterprise user but if I were writing code to do that I might use coroutines to get some of the work done. I know the network request code runs asynchronously, so that can be used to send values to a server in the background, as long as the initial request is small enough.

You will not be able to have your code fire up when the device turns on. That sounds shady as hell, too. Why are you trying to do that? Android probably lets you do it but iOS definitely will not, thankfully.

@WarrenW, you can indeed create code that would run in background. The only limitation is that the code be created using native language (Java or Obj-C/Swift). 

Corona being OpenGL and all expects an functioning user interface running in the foreground. Any Corona Lua based API call’s behavior while background is untested, unknown and unsupported. It might work this release but not work on future releases and we have no plans to. I’ve heard of people on iOS getting an app backgrounded and getting GPS data. I’ve never heard of anyone getting it backgrounded on Android.

Now if you can build an Enterprise app that can be backgrounded and can collect your GPS data without needing to talk to the Corona/Lua side until it foregrounds itself, then you might find some success.

Rob

One non-shady example I can think of would be a running app. As a user I’d want to record the GPS data as I go, but I wouldn’t want to leave the app open as it would drain the battery. I’m sure there are plenty of other “safe” app ideas that would need to access GPS in the background.