Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does PhoneGap localStorage save to iCloud?

If I make an app in PhoneGap that uses localStorage to store key/value data, will this data be synched to other devices via iCloud? I don't need to save much data.

like image 401
kschaos Avatar asked Oct 18 '11 20:10

kschaos


2 Answers

I disagree with @sciritai.

localStorage in iOS is just an SQLite db file that is stored somewhere on the device.

Perhaps things were different in a previous Phonegap/Cordova version, but in the current version Phonegap writes the localStorage.db file into the Documents directory for your app.

Specifically: Documents/Backups/localstorage.appdata.db

Since the Documents directory is specific for each app, it will be automatically saved to iCloud.

I can confirm this when I check out the iCloud settings in iOS (under Storage & Backup > Manage Storage).

I can see that my HTML5 iOS app is being backed up to iCloud. And that includes the data in the localStorage :)

I believe that means if you have multiple devices, that the localStorage would be synced between them - although I have not confirmed that myself. I'm not sure how iOS would deal with conflicts in the localStorage file actually.

like image 160
asgeo1 Avatar answered Oct 18 '22 15:10

asgeo1


I'm with @asgeo1 on this on this one. An phonegap app I just submitted has been rejected by apple because it makes heavy usage of local storage of temporary files and these were being entered into backups on icloud.

The fix is to add this to your config.xml:

<preference name="BackupWebStorage" value="none" />
like image 38
ED-209 Avatar answered Oct 18 '22 15:10

ED-209