Meteor - How do I save local data persistently on mobile? - android

Is it possible for data in a Meteor app deployed to a mobile device to be saved locally so that it persists across sessions.
I would like my MEteor app to be used without Internet connection.
However, the local database keeps resetting everytime I start a new session. This is how it behaves in the browser I know but not something I want happening on an app. I assume every time the app is replaced in memory, the local data storage is reset.
I've tried using Session variables, tried saving it in collections and anonymous collections - they all get wiped every time I delete the app from my recent apps list.
For Meteor, is there a way to save data to a mobile persistently?

I would suggest to start here: https://blog.groupbuddies.com/posts/45-offline-web-apps-with-meteor

Related

How Not to Pull Data From Firebase at Every Startup of the App #AskFirebase

I am building an app for a gym which shows gym members info in a recyclerview at the app startup , the problem is at every fresh launch of the app the data is pulled from the firebase database and appears suddenly after 4-5 seconds in the recyclerview after the app starts, and i think this time will increase as the data grows.
If the data is same why pull it every time.
But i want to go one step further
what i want is when the user logs in for the first time all the data liked to that account should get pulled off and stored locally , i don't want to pull the data ever again even if the user is connected to internet, the changes user make should be made to realtime database as well as locally regardless how much data is created , so that i never need to pull data again once the user is logged in but just push the data every time it changes or grows or gets deleted, operations will happen to both local storage as well as at realtime database, so the user will always have local access to data he created.
And if he logs in again same thing happen again.
Is there a way to do it with firebase without implementing local sqlite database together with firebase realtime database.
This answer is for a use case where data is stored locally as well as on a remote server - similar to what's in the question. It may not specifically answer the question but may lead to a solution.
In the question, it appears there's local data and remotely stored data which are essentially the same - the OP is using sql to store locally and Firebase to store remotely. This is being done to 'speed up' the loading process and lower the amount of reads.
My suggestion is to use Firebase only. It's very fast and if coded correctly, the loading time should never be 4-5 seconds before the UI is available to the user (barring a bad internet connection if not using persistence).
Additionally, Firebase offers locally persisted data in two ways; cached data and persisted data (which are similar but read on)
Cached: Firebase apps automatically handle temporary network interruptions.
Cached data is available while offline and Firebase resends any writes
when network connectivity is restored.
and
Persisted: By enabling persistence, any data that the Firebase Realtime Database
client would sync while online persists to disk and is available
offline, even when the user or operating system restarts the app. This
means your app works as it would online by using the local data stored
in the cache. Listener callbacks will continue to fire for local
updates.
There's a lot more to it so please see iOS Offline Persistence and Enabling Offline Capabilities on Android
Your questions suggests that the Firebase SDKs provides this sort of functionality. It does not. You will have to implement something yourself.
The best way to tackle this in an easy and the most efficient way is to use the Room Persistence provided by AndroidX Architecture.
It is technically an ORM over SQLite. Please find the details here:
AndroidX Room Persistence

Mobile Device Lockdown (Android)

So, I'm creating my first custom android app and expect to deploy it internally on company-owned devices. There's offline data storage that happens in a SQLite database. I want to ensure that the users cannot remove my application and/or destroy this database (which seems to happen when the app is uninstalled). Any help would be greatly appreciated!

Firebase firestore data persistence on mobile(specifically Android)

I'll like to know if it is possible to increase the size of the local cache of the firebase firestore database?
Will also like to deepen my knowledge on how firebase firestore offline
data persistence functions on mobile( android specifically).
Let me explain my use case and you evaluate if firebase firestore is the route to go for me.
I require a local database that can be synced averagely after every 24 hours and I require it to function offline and persists it's data. The main use case is this: I have a messaging feature integrated into the application and just as everyone expects to see his messages he's got to send and receive before he was disconnected that is, just as even when one is disconnected, he still can see his different conversations on whatsapp even after a phone reboot, that's how i expect my application to follow and I want to know if firebase firestore local cache offers me this possibility of persisting the cache even after phone reboot without having to connect to the internet? I do expect a lot of reads from the local cache but not that of writes while offline.
To summarize my question, can the local cache persists changes that have been made while the phone was offline even after phone reboots without any connection to the internet? Thank you all for your answers and time taken to read this in advance.
Please, do include some helpful links to tutorials showing how to use it if you do know any of them.
The size of the local cache depends on the size of the storage of your device. If you want to increase the size of your local storage, then you just need to free some space or buy a new hardware. There is no limitation regarding the maximum size that can be stored on your device.
Cloud Firestore supports offline data persistence. This feature caches a copy of the Cloud Firestore data that your app is actively using, so your app can access the data when the device is offline. You can write, read, listen to, and query the cached data. So, Cloud Firestore persists the data you write on a device to a local database. So the next time you start the application, it will indeed be able to read that same data, even when the device has never been connected to the Firebase servers. And as an answer to your question, yes it can.
But don't use Cloud Firestore as an offline-only database. It is really designed as an online database that came work for short to intermediate periods of being disconnected. While offline it will keep a queue of all your write operations. As this queue grows, local operations and app startup will slow down.
Nothing major, but over time these may add up. But remember, all these operation will persist even if you restart the device. You not gonna lose any data.

Meteorjs, cordova and local mongodb (online & offline mode)

I have a question about meteorjs and cordova mobile app development: will mongodb work locally on my mobile app (built with meteorjs and cordova) even if I turn internet connection off ?
My app will require only locally stored data (but need more space than localstorage provides) and I'm not sure how Meteorjs-cordova apps works after compilation to mobile (android & iOS) - does it have its own MongoDB instance inside it?
And if yes, is it possible to run it in offline mode?
Scenario:
internet connection is needed only on 1st run to download data, next time You can load everything locally and don't need to be connected to the internet.
Any information will be appreciated.
Your mobile app won't have an exact MongoDB instance on it, but you can use minimongo to store data in-memory on the client-side. So if you pull data from your server MongoDB instance, it'll be stored in minimongo until your app is closed. The data isn't persistent so you'll need something like this package to save data between launches.
See this answer for more information

Get data from installed android app

I recently wrote and installed an Android app on my device. The app wrote data to the local SQL database and uploaded this data to my webserver. But due to network problems, there are a few records that were skipped, so they aren't on my webserver.
Now i want to get those rows (or my full SQL database) from my android device. But my question is how?
If I write a new version of my app and reinstall it, then all my data will be lost.
Isn't there a way to access my SQL database without losing my data?
My device is not rooted, so those backup app's won't work...
You may get access using DDMS.

Categories

Resources