Handling Sync error in android JAVA sdk app whle using flexible sync

Hi Team,

I have been developing an android app in java using flexible sync. Everything is fine just an issue that,
Sometimes write operation does not sync and in logs I can see this error-

> E/REALM_SYNC: Connection[1]: Session[1]: Bad sync progress received (2)
> E/REALM_JAVA: Session Error[wss://realm.mongodb.com/]: CLIENT_BAD_PROGRESS(realm::sync::ClientError:107): Bad progress information (DOWNLOAD)

It is written locally but not on the server. Re-installing app is fixing it.
Just want to know how to handle sync errors, I know I need to reset the client but how to detect in-app​ that reset is required and do it.
I have gone through the docs, but still not clear.

Please help as handling sync errors is very important before going in production.
And please if possible tell the reason for this particular error.