Offline storage: How Raygun stores your data for offline monitoring on mobile and desktop

| 3 min. (511 words)

We hope our mobile applications and websites are available for our customers 24/7, but hope is a shaky thing to rely on. Internet outages happen, causing a myriad of headaches from lost business to lost data.

Raygun’s offline storage feature ensures you don’t lose precious crash data in the event of lost network connectivity.

Raygun Crash Reporting will detect when your application can’t connect to our API. This suggests to Raygun that you have gone offline, sending a signal to store crash reporting data in the browser or in a folder on your machine. This way, if a crash or error occurs in your application while you are disconnected from the internet, you will be alerted s soon as you come back online.

Raygun’s JavaScript provider supports offline storage for websites, while the following providers support offline storage for mobile applications: iOS, Android, .NET.

Enable offline storage in your JavaScript applications

To enable offline storage, call the following after your init() call:

rg4js('saveIfOffline', true);

The error is saved to local storage if an error is caught and the Raygun API cannot be reached, or if the request times out after 10 seconds. More information is available in the JavaScript provider documentation.

Enable offline storage for your iOS applications

The iOS provider automatically handles offline storage. If the crash report cannot be sent due to network connectivity loss, the provider saves the crash data in a folder located on the machine. When the application restarts, the crash data is sent to your Crash Reporting dashboard.

Enable offline storage for your Android applications

Like the iOS provider, the Android provider automatically handles offline storage. If the crash report cannot be sent due to network connectivity loss, the provider saves the crash data in a folder located on the machine. When another crash report message occurs, the provider checks internet connectivity, and if available, will send the cached messages or again save the message to disk.

A maximum of 64 messages are cached, then overwritten. More information is available in the Android provider documentation.

Enable offline storage for your .NET applications

Offline storage is available for the following .NET platforms:

  • Xamarin
  • Windows Phone
  • Console applications
  • WPF
  • WinForms

The .NET provider automatically handles offline storage for the listed platforms. Similarly to the iOS and Android providers, if the crash report cannot be sent due to network connectivity loss, the provider saves the crash data in a folder located on your machine. When another crash report message occurs, the provider checks internet connectivity. If available, it will send the cached messages or again save the message to disk.

A maximum of 10 messages are cached, then overwritten.

Enabling the offline storage feature will save your data

It’s a huge pain when your mobile application or website has network issues. However, Raygun’s offline storage feature ensures crucial crash reports aren’t lost. The offline storage feature is available for mobile applications and websites, depending on the provider. Raygun Crash Reporting works behind the scenes, even if your network connection isn’t.

Now read

How to catch elusive offline errors