Open mikemee opened 8 years ago
Yes, it sounds like something that would make sense to document as part of the website documentation
From https://developer.android.com/guide/topics/data/autobackup.html
During Auto Backup, the system shuts down the app to make sure it is no longer writing to the file system. By default, the backup system ignores apps that are running in the foreground because users would notice their apps being shut down. You can override the default behavior by setting the backupInForeground attribute to true.
From the doc, if backupInForeground
is true, Android auto backup could backup Realm file while the app is running. So there is chance it will restore a corrupted Realm file.
need to check the behaviour and doc this.
android:backupInForeground Indicates that Auto Backup operations may be performed on this app even if the app is in a foreground-equivalent state. The system shuts down an app during auto backup operation, so use this attribute with caution. Setting this flag to true can impact app behavior while the app is active.
Hmm, might be my misunderstanding. It should mean that if this is true, Android will force stop the app even when it is in foreground. If that is the case, then it is OK.
from #2603
While adding a section about
writeCopyTo
for the docs I started thinking about Google Play Services Backup/Restore.We should investigate how it actually works in detail. If it takes a backup of an open file or restore it overriding an existing file, it might explain some of the weird Illegal File errors we are seeing from time to time.
Also having it documened how it actually works also be beneficial.
Goal
Recent versions of Android now do full backups of any app created data by default. This seems to include any realm databases and their associated working files. This does not seem like a recipe for success. It would be useful to have documentation on:
E.g. see https://stackoverflow.com/questions/30804168/what-does-it-mean-should-explicitly-set-androidfullbackupcontent-to-avoid-ba/31984792 and https://github.com/realm/realm-java/issues/2552, which I came across when trying to solve this same problem (and then realized that it was even more complicated than I expected).