since android does not support app lifetime callbacks, call flush() in the main activity onDestroy method