How long can an iOS app stay live in the foreground?

I wanted to know can I run an iOS on an iPad for an indefinite amount of time?

"Live in the foreground" might be a tricky state to pin down. Speaking very loosely, the foreground app is going to see a change its status shortly after the device locks (displays its Lock Screen or shuts down the display) that will prevent it from continuing to consume battery-using resources. There are APIs that will allow apps to continue running in the background, such as background modes.

What is your actual use-case here?

How long can an iOS app stay live in the foreground?
 
 
Q