You need to guarantee that file data is written to disk immediately, regardless of the filesystem in use and the platform version.
Syncing ensures that the buffer catches up with the physical disk.
You can get a FileDescriptor reference from FileOutputStream, and then sync, as shown in the next listing.
public static boolean syncStream(FileOutputStream fos) { try { if (fos != null) { try { fos.getFD().sync(); } catch (IOException e) { Log.e(Constants.LOG_TAG, "Error syncing fos " + e.getMessage(), e); } return true; } return false; }