Hallo everyone, I am trying to create a novel application, where this application can be run in offline or online mode, before I make this application I want to know one important thing that is the database at the time of offline mode, as we know that the code has tinydb as an offline database but I hesitate to use it because, my application will store many novels which have many episodes. so can tinydb be used to store a lot of data at once just like an online database?
If you don’t want to use tinyDB, you can download and save csv on first run and then use file as offline database
it seems that I need a guide to do this, can you give me a little knowledge?
Since I do not know how big is your database first try with tinyDB. On screen initialize check if is firstrun, check if network is fast and call online data and save table to tinyDB. Next time app runs check network and if false use tinyDB as database
Else same procedure only instead of saving to tinyDB dowload to ASD and again if no network then read from csv. Useful extensions Extension to download file(s) to ASD (app-specific directory) without WRITE permission and MFile - a modified version of Sunny's `EFile` extension - Shared folders - storage permissions - Android 11+
I will give you a little overview of the algorithm,
novel application with offline or online reading features
- The first time users open the application, they are required to use an internet connection.
- when at home the application will automatically save data, where all novel data will be downloaded and stored offline, the data will increase if there is new data
- when the user opens the application without internet, the user can still read the novel because the data has become offline
if you know the telegram application that can open messages and view pictures and videos when the user does not have an internet connection, that’s more or less how the application works that I want
it will use a lot of blocks on tinydb
Why lot of blocks? Single tinydb is enough to store the data and you can easily recover it without any global lists…
I practically experienced this…
If you are using multiple then you will feel harder to spot the error .
there is a lot of data to be saved if using tinydb, because there will be data, names, episodes, types, stories, so I want to save data for each episode in tinydb, the problem is can tinydb store different data with the same tag?
You will simply save table to tinyDB and then use the procedure you use to populate lists. You won’t change anything else. For example
When screen initialize check if network is connected. If not set global data to get table from tinyDB and then call your procedure to populate lists
what if I retrieve data from a spreadsheet?
In the example above data is retrieved from a google spreadsheet. How do you get data ?
in thisblock I just took the data yet save data on tinydb, …
Do not use global multiple variable, it will slower the app… just get the data from spreadsheet and put it in one variable(save this variable into tinydb) , from this global variable use select list item list block conveniently
it seems that I need your help, please show me a block, because it will be very helpful
Honestly I learn this technique from @Boban , especially from this post CLICK HERE, visit the link, get the AIA… I am sure you will feel how it is easy and how the app work faster from single variable rather than from multiple
I’ve seen it, but can it be combined with yusuf’s dynamic component?
Yes it can
If your list items are more pls use the recycler extension (which creates component in lightning faster) than dynamic componet… else you can prefer dyna comp
it seems that I already know how to make my application offline, and now I just need to find out how when going to save data the application will make csv