App restart itself after open a link in browser? [SOLVED]

svintaj

  • *
  • Posts: 298
My android app always restart itself after open a link in browser, using the block 'open URL in browser'? So if I hit the back arrow to switch back to my app, it has jumped back to the start scene. And I have nothing in my code that does that, so it happens when the app "loses focus" and sits idle in the background.

Is there a way I can prevent this?

I also wonder if it is possible to have an app running in the background as long as I want? Now my Stencyl made apps stops or resets to the start scene after idle a longer time in the background. Also timers does not seem to work when the app does not has focus/ is idle.

« Last Edit: July 30, 2015, 12:09:32 am by Jon »

Jon

  • *
  • Posts: 17529
If the app is restarting itself, the phone is deciding that it doesn't have enough memory to hold both tasks at once. This is normal behavior for any phone and happens really frequently in normal, non-game usage like web browsing. You'll notice that pages will need to completely refresh when you switch between tabs.

Timers are definitely not expected to work while an app is in the background. You can work around this using the focus event and calculating the difference in recorded time.

svintaj

  • *
  • Posts: 298
That make sense, my current app uses much memory. I had this working smoothly in another app, so I couldn't see what was happening here.  I didn't know about the focus event, I'll use that to fill in the time gaps.

Thanks Jon!


svintaj

  • *
  • Posts: 298
Just curious, so how could I then send an message to the user while my app is idle in the background? Say like an reminder app, is that possible with Stencyl?

Jon

  • *
  • Posts: 17529
Right now, that kind of use case would require either an extension or a web service to dispatch  a reminder to the user. The latter is probably easier to do.

svintaj

  • *
  • Posts: 298
Ok, thanks again Jon! Now after some Atlas unloading my app behaves as expected and does no longer restart itself when idle. I really like how easy there is to bind or unbind Atlases in Stencyl, good work.