Direct question: "Can an app stay active while I leave it?" I don't know if this is possible as it would seem like this is an OS issue. Even if you sent updated inputs every 10 seconds, the phone would prolly suspend the website to save battery.
Indirect question: "I have inputs I want to save, is this possible?" Yes! Check out this example app from the enableBookmarking docs: https://shiny.rstudio.com/reference/shiny/1.2.0/enableBookmarking.html.
# Update the browser's location bar every time an input changes. This should
# not be used with enableBookmarking("server"), because that would create a
# new saved state on disk every time the user changes an input.
ui <- function(req) {
fluidPage(
textInput("txt", "Text"),
checkboxInput("chk", "Checkbox")
)
}
server <- function(input, output, session) {
observe({
# Trigger this observer every time an input changes
reactiveValuesToList(input)
session$doBookmark()
})
onBookmarked(function(url) {
updateQueryString(url)
})
}
enableBookmarking("url")
shinyApp(ui, server)
Hopefully this solves your issue!