Shiny disconnects from server when moving away from browser app on mobile devices

I'd like to be able to have the app continue to stay connected to the server while navigating to other applications on my phone so I can navigate back and not lose my selections and data created while using the app. Is this possible?

1 Like

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:

# 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) {
    textInput("txt", "Text"),
    checkboxInput("chk", "Checkbox")
server <- function(input, output, session) {
    # Trigger this observer every time an input changes
  onBookmarked(function(url) {
shinyApp(ui, server)

Hopefully this solves your issue!


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.