Create a routine called "WatchDog" that sets a StartServiceAt schedule for one hour in the future that will run a service called "LogoutandUpload".
Then everytime the user does some type of interaction in your app, call the "watchdog" routine - this will have the effect of constanly kicking the time of the startservice more and more in the future, so it never gets a chance to trip if the user is actively using the app.
Then, when the user stops using the app, after an hour, the startservice will trip and run the service, and this service could then possibly log the user out automatically, then submit the data to the servicer.