SensorbergSDK.BackgroundTaskManager.UpdateBackgroundTaskAsync C# (CSharp) Method

UpdateBackgroundTaskAsync() public method

Renew the registrations of the background taks.
public UpdateBackgroundTaskAsync ( SdkConfiguration configuration ) : Task
configuration SdkConfiguration Configuration for the new registration.
return Task
        public async Task<BackgroundTaskRegistrationResult> UpdateBackgroundTaskAsync(SdkConfiguration configuration)
        {
            UnregisterBackgroundTask();
            return await RegisterBackgroundTaskAsync(configuration);
        }

Usage Example

        public async Task <BackgroundTaskRegistrationResult> UpdateBackgroundTaskIfNeededAsync()
        {
            BackgroundTaskRegistrationResult result = new BackgroundTaskRegistrationResult()
            {
                Success   = true,
                Exception = null
            };

            if (BackgroundTaskManager.CheckIfBackgroundFilterUpdateIsRequired())
            {
                result = await _backgroundTaskManager.UpdateBackgroundTaskAsync(Configuration);
            }

            SdkData.BackgroundTaskEnabled = true;
            return(result);
        }