How to know if the app is running in the background?

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

How to know if the app is running in the background?

Post by Jellobus » Tue Mar 29, 2016 6:33 pm

Hi all,

When I launch Twitter app from the current app, Twitter app pops up and the current app will be idling and running in the background. Is there any message sent when the app goes in the background? Or Is there any walkaround to know the app is in the background?

Thanks a lot in advance!

Louis

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: How to know if the app is running in the background?

Post by jacque » Tue Mar 29, 2016 6:47 pm

There is no way to know if the app is in the background on Android. Android OS will control the app, and if it does not need the RAM, the app will remain running in the background and re-open at the same state it was in before. It acts as though the user never left. But if the OS needs the RAM, it will close the app and the current state is lost.

The next time the user goes back to a closed app, it will start up all over again and get a preOpenStack and openStack message. If the app has not been closed, those messages are not sent. So you can add commands to either of those message handlers to set up your app again if you need to.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Re: How to know if the app is running in the background?

Post by Jellobus » Tue Mar 29, 2016 7:05 pm

Hi Jacque,

Thanks for the detailed explaination. I couldn't solve the issue but I always learn a lot from gurus like you. Again, thank you very much for your help!

Have a nice day :D

Louis

Post Reply