Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document backup behaviour #249

Closed
mo22 opened this issue Nov 13, 2019 · 14 comments
Closed

Document backup behaviour #249

mo22 opened this issue Nov 13, 2019 · 14 comments

Comments

@mo22
Copy link

mo22 commented Nov 13, 2019

Motivation

Hi, it would be nice if you could update the documentation to include information about whether AsyncStorage data is stored and restored in iCloud and android backups, and what configuration steps might be necessary for this (i.e. android manifest android:fullBackupContent etc.)

Description

see Motivation

@krizzu krizzu added the LEGACY label Nov 17, 2019
@krizzu
Copy link
Member

krizzu commented Nov 17, 2019

Good idea. On iOS, AsyncStorage saves the data to the file, that's accessible for user to look into. There's a feature request that allows you to change the default save location. We'd have to keep this in mind if we were to write docs about it.

@krizzu krizzu added the enhancement New feature or request label Nov 17, 2019
@zwenza
Copy link

zwenza commented Nov 18, 2019

I would really appreciate that! Is there any information already somewhere how to properly backup and restore AsyncStorage data?

@krizzu
Copy link
Member

krizzu commented Nov 19, 2019

@zwenza

Here are Android docs regarding auto backup (Android 23+). Haven't tested it against AsyncStorage though.

@mo22
Copy link
Author

mo22 commented Nov 23, 2019

Android:

IOS:

  • https://developer.android.com/guide/topics/data/autobackup.html
  • generally Library/ and Documents/ are backed up unless a special file attribute is set
  • restoring AsyncStorage settings works out of the box for me for iOS 13.3
  • To test backup and restore without actually restoring the phone you can offload an app using settings / storage and click "Offload App"

@krizzu krizzu removed the LEGACY label Apr 12, 2020
@nishanttatva
Copy link

@mo22
Is there any way to opt-out of auto-backup feature in iOS?. In android changing android:allowBackup="false" does it. Anything similar in iOS? I have a privacy concern and need to clear the app data on uninstall.

@mo22
Copy link
Author

mo22 commented Aug 27, 2020

I don't think there's an built-in way.

You could use https://github.com/mo22/react-native-mo-fs and manually set the backup attribute for the storage directory.

Fs.ios.Module.setResourceValues('file:///path/to/file', {
  'NSURLIsExcludedFromBackupKey': true,
});

@krizzu
Copy link
Member

krizzu commented Aug 28, 2020

@nishantpillai5
Related issue. I'll come up with solution in upcoming days

@tido64 tido64 added documentation and removed enhancement New feature or request labels Oct 14, 2020
@compojoom
Copy link

We'll in the latest version one by default opts out of backups. However I'm wondering how everyone else managed to get app data backed up in the first place?

I've tried with 0.13 and pre 0.13 releases - our app data never gets saved in the cloud. Do I need to enable some capabilities?

We use redux and redux-persist and redux-persist stores the data using async storage. I've downloaded the appData from the phone and I can see that the async files are stored inside of the Docs folder. So I don't understand how everyone else managed to back up the data in the cloud and I didn't :)

@krizzu
Copy link
Member

krizzu commented Oct 24, 2020

We'll in the latest version one by default opts out of backups. However I'm wondering how everyone else managed to get app data backed up in the first place?

Devs were raising concern that might be the happening in some cases for their users. I could not repro this myself, but went ahead and added a this as a feature toggle, off by default.

Here is the documentation about it
https://react-native-async-storage.github.io/async-storage/docs/advanced/backup

@krizzu krizzu closed this as completed Oct 24, 2020
@compojoom
Copy link

compojoom commented Oct 26, 2020

@krizzu - I saw those docs. I was actually asking - how do you force AsyncStorage to store the data in iCloud? We've set the RCTAsyncStorageExcludeFromBackup to false, but our data is never uploaded to icloud. How does one configure an app to upload the data? Is there something in XCode that needs to be configured? I added iCloud as capability in it, but our data never left the device...

@rdonnelly
Copy link

@compojoom

how do you force AsyncStorage to store the data in iCloud?

It’s worth noting that this is different than storing the value in iCloud storage. This is related to storing the data in an iCloud backup, which comes back when you restore the phone (which was the original problem). My initial thought when reading the docs was that this data would save/sync to iCloud (which would be available in other devices). I was confused for a good bit, so I figured I’d share. 😄

I don’t necessarily think any change needs to be made to the docs, but if it’s easy and others have similar confusion, it might be nice to add a note. 💭

@QiYuNew
Copy link

QiYuNew commented Feb 20, 2021

Hello - I uninstalled my app on iPhone and there is backup file saved on iCloud. How can I restore the data after I reinstall the app?

@ttristan
Copy link

It’s worth noting that this is different than storing the value in iCloud storage. This is related to storing the data in an iCloud backup, which comes back when you restore the phone (which was the original problem). My initial thought when reading the docs was that this data would save/sync to iCloud (which would be available in other devices). I was confused for a good bit, so I figured I’d share. 😄

I think the docs could be more clear on this part. I also thought that data is actually synced via iCloud between devices. Seems like this is not the case.

@nhatduy209
Copy link

Hello - I uninstalled my app on iPhone and there is backup file saved on iCloud. How can I restore the data after I reinstall the app?
how can you save data on icloud ? Pls help me , many thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants