Flutter Online/Offline Mode - sqlite

i am just looking for ideas about how to make the app work in online and offline modes( its a shopping online app)
Suppose the app is running in an online mode and suddenly the internet goes if i want to switch to offline mode the data will be saved in the cash or should be in a local db suck as sqlite
if the app from the originally runs in offline mode where to save the data of the offline mode in a local db or Json file
i am just looking for suggestions - i was always working with online modes but the customers are asking to switch
thanks a lot

you can use connectivity to check for internet connection
This plugin allows Flutter apps to discover network connectivity and configure themselves accordingly. It can distinguish between cellular vs WiFi connection. This plugin works for iOS and Android.
if offline show saved data from a local persistent store
for data persistence you can look at moor,json_store ,sqlite

Related

How to persist data locally with firebase realtime database in react native?

I am a newbie to mobile development and I am building a mobile game in react native for android devices where I want to store user centric information such as score for different levels in realtime database in firebase. My users would be in playing game in restricted internet connectivity(where user connects to internet once in few days) and I want a mechanism such that app should store data locally even when the application "RESTARTS" or the app is killed by user and when internet connectivity comes, should be able to push all data on server.
I have two questions:
Can I some how automatically send data to server without user opening the app when the internet connectivity is established?
I found support for enabling offline data persistence in case of application or operating system restart for android in Java and kotlin
(https://firebase.google.com/docs/database/android/offline-capabilities), but did not find support for react native. I have gone through documentation of React Native Firebase library (https://rnfirebase.io/docs/v5.x.x/database/reference/database), but did find option to enable data persistence option for case when application/os restarts. Is there any workaround for this?
What you are looking for is Cloud Firestore, it has data persistence built-in so you won't have to worry. Use react-native-firebase for that, it has an absolutely beautiful documentation and guides and the community is very helpful too.
To sync your local data with the server without user opening app, you'll need to delve into the native side and make an Android Service that runs in the background and checks for internet connectivity regularly. As soon as the internet is connected, it can start the Cloud Firestore sync.
Do not use Realtime Database for this. Use Cloud Firestore which is way better.

Persisting state of Firebase data [duplicate]

I have built an application with Firebase and I've also made a desktop version available with nw.js. The point of this being to allow for better offline usage in areas with bad or no internet (and it will sync when the user gets internet again). Now, I can disconnect just fine and reconnect while the app is running, but I want to be able to fully close and reload the application. I've seen this blog post from firebase, but it appears this only works for mobile platforms.
Is this currently possible on the web platform, too?
All Firebase SDKs will handle intermittent loss of connectivity (driving through a tunnel). But disk based persistence, which allows the data to survive an app restart, is currently only available in Firebase's iOS and Android SDKs.

Ionic/Firebase store data local and sync [duplicate]

I have built an application with Firebase and I've also made a desktop version available with nw.js. The point of this being to allow for better offline usage in areas with bad or no internet (and it will sync when the user gets internet again). Now, I can disconnect just fine and reconnect while the app is running, but I want to be able to fully close and reload the application. I've seen this blog post from firebase, but it appears this only works for mobile platforms.
Is this currently possible on the web platform, too?
All Firebase SDKs will handle intermittent loss of connectivity (driving through a tunnel). But disk based persistence, which allows the data to survive an app restart, is currently only available in Firebase's iOS and Android SDKs.

SQLITE Database for Windows Phone 8.1(Silverlight)

I am developing an app for windows phone 8.1 using SilverLight in that I am storing details of some products using sqlite but I want to know how can I store that data permanently means when I close the emulator the data is lost. So please let me know how do I store that data.
When you close the emulator, all the data is lost and all the apps deleted. Imagine it as doing a hard reset on your device.
Your only solution is not to close the emulator or get a real device for testing.

Persist data with firebase web

I have built an application with Firebase and I've also made a desktop version available with nw.js. The point of this being to allow for better offline usage in areas with bad or no internet (and it will sync when the user gets internet again). Now, I can disconnect just fine and reconnect while the app is running, but I want to be able to fully close and reload the application. I've seen this blog post from firebase, but it appears this only works for mobile platforms.
Is this currently possible on the web platform, too?
All Firebase SDKs will handle intermittent loss of connectivity (driving through a tunnel). But disk based persistence, which allows the data to survive an app restart, is currently only available in Firebase's iOS and Android SDKs.

Resources