This is a migrated thread and some comments may be shown as answers.

Working Offline

1 Answer 53 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
David Weinberg
Top achievements
Rank 2
David Weinberg asked on 10 May 2016, 10:38 AM

Hi,

I am developing an hybrid app that I would like to be able to work entirely offline. It is data processing using Backend Services. Ideally it needs to just work when offline, including cold starting with no 3G or WiFi. Initial sign in will need to be done online but then all actions should be possibly against cached data, with new records /updates being synchronised when signal is available. Data needs to persist between sessions, especially unsent changes.

I am thinking that it should work like for example an mobile email client. Recent email are stored on the device for access when the devices is offline. Features such as search, folders, etc. work (with the data on the device). New emails can be composed and in the background will be sent when data is restored. 

I know that Telerik has offline support and I am using this and the caching setting but it is not quite there for me yet. I am keen not to reinvent the wheel and am sure that I can do this fairly simply with the existing Telerik tools.

Can anyone point me in the right direction to working with a local cache by default and ways to populate the cache with recent data items. Am I looking at a lot of work and a rewrite to do this?

Thanks in advance,

David

1 Answer, 1 is accepted

Sort by
0
George
Telerik team
answered on 12 May 2016, 11:37 AM
Hello David,

Thank you for contacting us.

I think that our offline support fits your use case perfectly. As from the Offline Support in the JavaScript SDK article: The Backend Services JavaScript SDK's offline support helps you create apps that remain nearly fully operational even when completely disconnected from the backend. It does that by storing data locally on the device and then synchronizing it after re-connecting to the backend. In the above mentioned article you can also see the use cases and specific features our offline feature supports. You should also not need to rewrite your code. You can simply enable the offline storage by setting the offline option to true when initializing the sdk. You will also need to switch the sdk's mode to online/offline depending on your device's connection state. You can also take a look at our Deliveries sample which should cover most, if not all of your use cases.

Also, you can configure the caching as explained here in order to provide the required caching capabilities for your app. This way you can configure a longer caching period or force an operation to ignore/prefer cached values. At predefined intervals or when the app becomes online you may just need to make a request that ignores the cache and reads the fresh data instead.

The latter can also be achieved by using the syncUnmodified setting and obtaining the latest data from the server at the time of syncing the offline data.

This said, I believe that your scenario can be achieved by configuring properly the SDK options and data operations and passing them the needed settings depending of your app's state and requirements.

I hope this will help.

Regards,
George
Telerik
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
Tags
General Discussion
Asked by
David Weinberg
Top achievements
Rank 2
Answers by
George
Telerik team
Share this question
or