App pause behavior

All, 

   Happy 2020 everyone!  I have a question on how an app is supposed to behave.  

I have written an app that uses sockets to send mqtt messages to a broker which includes all the phone sensors.  It seems to work great.  I am in early testing phase.  The app stops sending events when the phone screen dims.  So the user has to keep touching the screen to keep the events flowing.  

  Qs: 

1.  Is this how it is supposed to work?   Is there a way to turn that behavior off?  

2.  If 1. == true then Is there a trick to keeping the screen from dimming?  

L

  1. Yes, Corona apps don’t support running in the background. I don’t think that there are any easy ways of disabling that.

2) http://docs.coronalabs.com/api/library/system/setIdleTimer.html

Thanks,  for the info. 

Just so I understand,  if I wanted to create a music application I would have to burn the screen all the time to let the music play?  

Yep.

There may be some ways to get the app to keep playing music (or remain active) even when suspended, but that’d require Corona Native and I’m not sure if it’d be possible even with that.

Maybe leaving the screen on, dimmed with a screen saver of some kind.  

Is there a way to know if the phone is plugged in?   Maybe only leave it play when charging or above 50% charge.  

Souns like a bad idea but yes it can be done. Google for it.

A followup question: is there a way to set the timeout value for the idle timer?

Corona is the wrong tool for what you want.  You’ll need to go to native development to allow your app to run in the background.