2 Replies Latest reply on May 8, 2014 3:01 AM by Graham Bird

    How should we handle application close events on Android?

    Graham Bird

      This is an interesting question and one that I currently do not have an answer to.

       

      In our case, we have a RhoMobile application which is sending periodic data back to our server (checking for any new data etc).

      The users of the device have the option to switch to some other application(s) - for instance they use Copilot for navigating to addresses and may use various other applications.

      This then leaves the RhoMobile application running in the background.

       

      We have seen a few instances where the RhoMobile application has been closed unexpectedly and no errors are being logged to explain the issue.

      We believe that this is probably due to the Android device closing the application due to:

      1) Inactivity

      2) Lack of resources

       

      If this happens the RhoMobile application then restarts when the user next selects it, requiring them to log back in to the application in order to use it.

       

      There are two issues with this:

      1) We do not want our application to close - if it is closed then new data cannot be sent to it and we cannot receive any data from it on the server.

      2) If it does close then it would be nice if we could restore the application to its last known state (or at least a relatively safe state) rather than having the user log back in.

       

      If anyone has any thoughts on whether either of the above are achievable we would be very interested in the ideas.

       

      It would also be nice to record that the application has been terminated in the logs so that we can see that this has happened.

       

      Kind regards,

      Graham Bird.