Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Xamarin mobile app with Offline support ? #5942


User avatar
0
sedulen created

Hi,

I am working on a Xamarin mobile app that needs to work offline. However, I am dealing with a configuration issue. Basically it doesn't work with offline. At the start of the app, it downloads the configuration from here /AbpUserConfiguration/GetAll and store it in the cache. This configuration is where all of the server settings are stored, including localizations. I tried to modify the code to not download this endpoint if the offline but everytime the app restart, the cache is cleared out.

Instead of storing this information in the cache, which appears to clear every time the app restarts, is there a way to modify this code to store and retrieve using sqlite so that the app doesn't need to retrieve this configuration information every time the app launches?

My use case is that someone will download information from the server onto the mobile app, and then go out into the field to perform their job, where they are offline. They need to be able to use the mobile app while on the job and offline. Then they will return to their office where they have an internet connection and sync their data back to the server when they are online again.

Thanks, -Brian


3 Answer(s)
  • User Avatar
    0
    sedulen created

    per feedback from another developer on the Slack channel (yeah Slack!), he directed me into using this library:

    https://github.com/jamesmontemagno/monkey-cache

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @sedulen :)

  • User Avatar
    0
    alper created
    Support Team

    Your use case is a common offline usage, as far as I know AspNet Zero Xamarin app shouldn't delete any cache. It just work online and that's why it retrieves the configuration file on every startup. So you need to change that behaviour. Force user to login for the first time (for initial setup). In there, cache the user configuration (with AbpUserConfiguration/GetAll) And whenever the code tries to retrieve the configuration file, check internet, if no connection then get the configuration from cache. I hope it will not be a big issue.