added a way to control flushing when the app becomes inactive
Merge pull request #1 from mattetti/master

added a way to control flushing when the app becomes inactive