Saving data on mobile
Posted: Wed Mar 17, 2021 9:39 pm
On deploying an app to mobile, I provide its data by including a data text file through 'Copy Files' in the standalone settings.
I then import the data into the app using the following code:
This works fine on mobile, and if the user then subsequently adds data, this is then saved as expected in specialfolderpath("documents").
However, if the app is closed and then restarted, the previously saved data is then, I think, overwritten by the original file from the specialfolderpath("resources").
I guess what I am trying to achieve is that on app installation on the mobile device, the data from specialfolderpath("resources") is transferred once to the app and then if the app is closed and opened again, it then only takes its data from specialfolderpath("documents").
I'm not sure how to achieve this, grateful for any help or suggestions etc.
Many thanks,
Glenn
I then import the data into the app using the following code:
Code: Select all
...
on openstack
set the defaultfolder to specialfolderpath("resources")
put url ("binfile:ArrayData.txt") into theEncodedArray
put arrayDecode(theEncodedArray) into vText
put specialfolderpath("documents") & "/" & "ArrayData.txt" into tMyPath
put arrayEncode(vText) into url ("binfile:" & tMyPath)
...
However, if the app is closed and then restarted, the previously saved data is then, I think, overwritten by the original file from the specialfolderpath("resources").
I guess what I am trying to achieve is that on app installation on the mobile device, the data from specialfolderpath("resources") is transferred once to the app and then if the app is closed and opened again, it then only takes its data from specialfolderpath("documents").
I'm not sure how to achieve this, grateful for any help or suggestions etc.
Many thanks,
Glenn