-
Notifications
You must be signed in to change notification settings - Fork 0
Cache
When enabled in ContribSentryOptions, the SDK will always try to cache your Session and Tracing Data and release those when they are sent to Sentry.
For Caching events, you must inform a Func function to ContribSentryOptions in HasInternet, if not set, ContribSentry will never cache SentryEvents. HasInternet is a simple call to check if your application has internet or not, if there's internet, ContribSentry will not cache it, otherwise, the SDK will cache and consume the SentryEvent.
In order for the Caching system to work, you must inform the Path in ContribSentryOptions.CacheDirPath, if not, the Cache service will be disabled.
By default, you can store 100 Transactions or Sessions + 100 SentryEvents, to change this number, simply alter the Options.CacheDirSize value.
It's recommended to set CacheDirPath with Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "Sentry")
When your app moves to the background or your app closes, ContribSentry might lose information, to avoid that, simply call ContribSentrySdk.Sleep when your app is moving to background or is closing, and ContribSentrySdk.Resume when your app goes back to foreground.
On a Xamarin forms application, you can place those functions at App.xaml.cs inside of OnResume and OnSleep.