Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Running a Corona SDK App in the backround
Started by joshuacalebbryan Aug 02 2014 06:18 AM

3 replies to this topic
run in background native app gps
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

joshuacalebbryan

[GLOBAL: userInfoPane.html]
joshuacalebbryan
  • Starter
  • PipPip
  • 11 posts
  • Member

Hello,

 

   I am currently trying to get my app to run in the background (mainly for it's GPS functionality). I have heard that this "is" and "is not" possible from different sources. I have read that making a native app is the way to go, but I am simply not sure how that works alongside using Corona SDK as well. Please enlighten me anyone who may know something about this. I want to use Corona SDK, and I want the app to run in the background. Is that possible at all?



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Corona Staff
  • 10,317 posts
  • Jedi

Let me try to explain.

 

Corona SDK's implementation of Lua expects the app to be in the foreground because there has to be a UI there.  In other words if your app tried to update a value on the screen, it won't work because the app has to be in the foreground.  You cannot use Corona SDK for backgrounded apps.   However, there are two exceptions:

 

1.  For iOS only you could play background audio since that doesn't need the UI present to work.  It's the only backgrounded mode that works.  Android does not support this.

 

2. If you were a Corona Enterprise subscriber, you could do your GPS work in native land and just store values until the UI came back to the foreground and then update as needed. 

 

Rob



[TOPIC: post.html]
#3

joshuacalebbryan

[GLOBAL: userInfoPane.html]
joshuacalebbryan
  • Starter
  • PipPip
  • 11 posts
  • Member

Thank you for your response Rob. Would the best way to do this include me adding the Objective-C code in my main.lua file or incorporate it in a custom library that I make?

[TOPIC: post.html]
#4

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Corona Staff
  • 10,317 posts
  • Jedi

You can't put objective C directly into your main.lua.  Corona SDK doesn't have any way to include Objective C.   For that there are two options that we offer:

 

Corona Enterpirse -- This platform lets you completely mix Corona SDK/Lua and both Objective C, C++ for iOS and C++ and Java for Android.  For iOS you would actually build your app using Xcode just like any native app and it incorporates Lua in it.  The UI of your app is still coming from Corona SDK.

 

Corona Cards -- This is a different angle on mixing native development and Corona/Lua.  In this case, your Corona App is just a view inside of anotherwise native app.

 

Rob




[topic_controls]
[/topic_controls]



Also tagged with one or more of these keywords: run in background, native app, gps