Restarting my Application?

Hi! 

I am encountering an error in other parts of my application whenever I click on this specific area in my app. A solution I found that made the application run normally again was to just kill the app (something along the lines of double tapping the home button and then swiping the app off screen), then starting the application up again. Evidently, this is a short term solution to the problem, but I’m hoping to have a solution in the meantime while I work on finding where the problem lies. 

So my question: Is there a way to “restart” the application that has a similar effect of closing the app and opening up again, or somethings that’s similar to the “relaunch” function in the Corona Simulator? I’ve seen os.exit(), which kills the app, but it’s not a restart and only does half the job. I’ve also been looking at scene:destroy() then goto another scene, but I’m not sure if that would have the same effect as what I’m looking for. 

Thanks!  

bump

iOS apps are not supposed to exit. While testing, you can use os.exit() but Apple will reject your app if you allow your app to exit.

If you’re using the Corona Simulator to copy your update to your device, it will shutdown and cold start your app for you.

Rob

Thanks for the reply Rob.

This is only an Android problem, so iOS won’t be affected if I do make any changes. 

I’m aware that updating info within my code will restart the simulator, but I was wondering if there was a method to restart the application for Android devices once it’s already built and running on an actual device. 

That’s what “Live Builds” are for. Simply tick the box on the build screen, then after that, as long as your device is on the same local network as your computer, it should cause the app to restart on your device just like saving does to the simulator.

http://docs.coronalabs.com/guide/distribution/liveBuild/index.html

Rob

bump

iOS apps are not supposed to exit. While testing, you can use os.exit() but Apple will reject your app if you allow your app to exit.

If you’re using the Corona Simulator to copy your update to your device, it will shutdown and cold start your app for you.

Rob

Thanks for the reply Rob.

This is only an Android problem, so iOS won’t be affected if I do make any changes. 

I’m aware that updating info within my code will restart the simulator, but I was wondering if there was a method to restart the application for Android devices once it’s already built and running on an actual device. 

That’s what “Live Builds” are for. Simply tick the box on the build screen, then after that, as long as your device is on the same local network as your computer, it should cause the app to restart on your device just like saving does to the simulator.

http://docs.coronalabs.com/guide/distribution/liveBuild/index.html

Rob