Background Fetch Implementation for Data Refresh

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Background Fetch Implementation for Data Refresh
Medium
from 1 business day to 3 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1054
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Implementing Background Fetch for Data Refresh

User opens app and sees current data—without waiting for load. Result of proper background sync. Done improperly—drained battery and user complaints.

iOS: BGAppRefreshTask

Since iOS 13, Apple moved background updates to BackgroundTasks framework. Old UIApplication.setMinimumBackgroundFetchInterval works but deprecated.

Task registration:

BGTaskScheduler.shared.register(
    forTaskWithIdentifier: "com.myapp.refresh",
    using: nil
) { task in
    self.handleAppRefresh(task: task as! BGAppRefreshTask)
}

Identifier must be in Info.plist under BGTaskSchedulerPermittedIdentifiers. Without this task won't register—no errors, just nothing happens. Typical first-time mistake.

Next run scheduled at end of current via BGAppRefreshTaskRequest. Minimum interval set via earliestBeginDate, but iOS decides actual run—considering battery, usage patterns, charge. No guarantees on specific time.

Important: background task has CPU time limit. If task doesn't finish in time, system calls task.expirationHandler. Must save progress and call task.setTaskCompleted(success: false).

Android: WorkManager

WorkManager—right tool for periodic tasks on Android. Replaces JobScheduler, AlarmManager, SyncAdapter in most cases.

val refreshRequest = PeriodicWorkRequestBuilder<DataRefreshWorker>(
    repeatInterval = 1,
    repeatIntervalTimeUnit = TimeUnit.HOURS,
    flexTimeInterval = 15,
    flexTimeIntervalUnit = TimeUnit.MINUTES
)
    .setConstraints(
        Constraints.Builder()
            .setRequiredNetworkType(NetworkType.CONNECTED)
            .setRequiresBatteryNotLow(true)
            .build()
    )
    .build()

WorkManager.getInstance(context).enqueueUniquePeriodicWork(
    "data_refresh",
    ExistingPeriodicWorkPolicy.KEEP,
    refreshRequest
)

ExistingPeriodicWorkPolicy.KEEP—doesn't overwrite existing task on enqueue rerun. Important on each app launch.

Minimum interval for PeriodicWorkRequest—15 minutes. System won't allow less.

What to Do in Background Task

Background task should be minimal: request only changed (incremental sync), save to local database (Room / Core Data), send local notification if important changes.

Don't do in background: heavy computation, large HTTP requests without timeout, sync work with UI layer.

React Native and Flutter

In React Native, background tasks via native modules. Library react-native-background-fetch wraps BGAppRefreshTask on iOS and JobScheduler/WorkManager on Android in single JS API.

In Flutter—workmanager plugin for Android, background_fetch for iOS. Same limitations as native platforms—abstraction doesn't remove platform constraints.

Timeline: single platform—3-5 days, iOS + Android with edge case testing (battery, no network, Doze Mode)—1-1.5 weeks.