How does offline storage/local storage work in maximo anywhere-work execution app. Please explain with sample.
localstorage set/get methods are used but how is data storage happening in device .Does it store in some device database?
We use the Mobilefirst Json store which is a local SQLite database. If you look in the JavaScript for ModelService.save that's where we save to the store. And ModelService.all is where we read from the store
It will remain there unless you clear data/cache of the app. Did you know that we still can login offline?
Related
I'm really new in Xamarin.
It's been some weeks I've started an app to play with, and I've just discovered NoSql world with Firebase DB stuff.
I read/watch a lot of things, it's was a big jump from the Relational DB world !
I'm asking for some advices about this topic please : caching or not caching data in a mobile app when data is coming from a NoSQL DB.
Examples of data to cache :
Authenticated user main informations,
Authenticated user favorite items,
...
Thanks !
Is it a good idea to cache data in a mobile application when reading a NoSQL DB?
Yes, it is since it makes your app work even if the device goes offline.
caching or not caching data in a mobile app when data is coming from a NoSQL DB.
Absolutely yes. According to the docs:
You can write, read, listen to, and query the cached data. When the device comes back online, Cloud Firestore synchronizes any local changes made by your app to the Cloud Firestore backend.
Besides that:
For Android and iOS, offline persistence is enabled by default.
For the web, offline persistence is disabled by default. To enable persistence, call the enablePersistence method. Cloud Firestore's cache isn't automatically cleared between sessions.
You should surely cache your data for a user session, while the user is still using the application.
You can allow the user to do pull to refresh.
Best with firebase DB you can have events published and update your cache accordingly.
I am working on react-native with firestore and creating an offline application. The data should be stored in firestore when there is an healthy internet connection. If not, it should be stored in cache.
In firestore, there is an Enable offline data where the data can be stored offline. But, I didn't understand what and where exactly I've to write into that.
So anyone can help me out?
Thanks in advance
in your firebase file immediately after
firebase.initializeApp(firebbaseConfig)
firebase.firestore()
.enable persistence()
.catch(err => console.log(err)
The documentation for offline persistence states:
To use offline persistence, you don't need to make any changes to the
code that you use to access Cloud Firestore data. With offline
persistence enabled, the Cloud Firestore client library automatically
manages online and offline data access and synchronizes local data
when the device is back online.
So, you don't have to do anything to take this default behavior.
Firestore maintains copy of data locally, so even it writes data in offline and fetch it.
If you want to enable firestore persistence in your react native app, just copy paste the code from documentation to App.js, I am using the same and it is working fine.
My iOS app's firestore cache seems to have got out of sync with Firestore. As a result I've had to disable persistence. Is there anyway to reset the cache? And is there a way to make sure it's constantly in sync? All I did was delete documents from the database!
There is now a feature in the API for clearing persistence. It is not recommended for anything but tests, but you can use
firebase.firestore().clearPersistence().catch(error => {
console.error('Could not enable persistence:', error.code);
})
It must run before the Firestore database is used.
There's no API for manipulating the local cache in any way. The Firestore SDK chooses what to store based on queries that you perform.
On Android, users can manually clear the local data for an app without uninstalling it. This will remove all the data locally stored by the app.
If you have a specific use case, please feel free to file a feature request.
Actually my data is in GB so every time manually sync for updating is not make sense. So I want to sync my SQLite database with Firebase database automatically, either it may be offline or online. And I want syncing from both ways. "FB to SQLite" and "SQLite to FB".
Is it in Android ? if you already have functionality to manual sync the data, then should not be a problem to automate it. You can call same sync functionality through a service, which in turn will use CountDownTimer. CountDownTimer as per preference can be called every couple of minutes or hourly.
There is no built-in functionality for Firebase to synchronize with SQlite, nor built-in functionality in SQlite to synchronize with Firebase.
But since both have an API, you can write code to do the synchronization for you.
Actually firebase use persistency to work while offline but dynamically can get only last event whatever it is. So have to write our own Sync for that.
I really enjoy using Firebase, and I would like to use it in a new app, but the app would have the user upload sensitive information.
I know Firebase uses https, but looking around, it seems Firebase does not yet make encryption at rest available.
Is there a way around this to use Firebase and still make an administrator unable to read the data from the Firebase Forge, for instance?
Thank you.
If you encrypt all data that you store in Firebase with a key that is only known to the client, it will not be readable by anyone but that client.
Update (20160528): As of a few months ago all data for the Firebase Database is also encrypted at rest.