Hello all,
I would like to know if you could help me.
The situation is: I´m building an mobile app and I want to add a feature to backup the information (I´m using local storage).
Till now I was able to export all information and save it into a CSV file as following:
First I inserted a first row, with a header, in a variable called FileContent. After I retrieved all rows from the entity, and with a loop, added it to the same variable. I used NewLine() at the end of each loop to add a new row. Then I converted the FileContent variable to binary, saved the file locally and finally I used I plugin to "share" the file, so I could choose where I would like to send the file.
Plugins I´m using:
My doubts now are:
Thank you!!!
There's the File Transfer plugin for uploading files to the device, and the File Plugin to access files on the device. I haven't used either, but judging their description they may be of use.
That said, it's very uncommon for mobile apps in general to allow backupping data via files. More typically backups are saved to cloud drives like Google Driver or One Drive (and retrieved from there).
Hi Thiago,
Why dont you use JSON Serialize/Deserialize to backup and read back the data? Seems easier than creating CSV.
As for importing, what are you questions about it? You need to store the data in the Local Storage, but I assume you know how to do that?
Hi Kilian,
Yes I know...
My doubt regarding it is for example, how do I will "get" the file inside the application to read the data?
I mean, I´m able to export all data as a file (json or csv) and send it through email...but how to "load" the file inside the application if I need to restore it?
Dont know if it is clear my doubt....
Thank you!!
Why do you create a file and mail it? Why not use a Server Action or a REST service to get the data at the Server?
Kilian Hekhuis wrote:
The idea is to have an "independent action" by the user. I mean, the user could backup and restore his own data without need any "special" service...just with a simple file. He can save it anywhere he wants.
Right. But in that case, the user must be able to download the file from somewhere, put it on the local file system, and you can read it from there?
That´s my point. Is it possible to do it?
And how do i search for this file?
Thank you Kilian. I will check these plugins.
Maybe it is a good idea to save to the cloud to.
I´ll think about it for sure!!!
Thank you for your help!
You're most welcome :). If any of my answers help you solve this, could you mark it as the Solution so this topic is marked as solved? Thanks.
Sure!