79748571

Date: 2025-08-28 01:02:31
Score: 4
Natty:
Report link

Some days ago i have same problem.At last i use background_location_tracker: ^1.6.1.It helps me a lot.In android it has param as trackingInterval.But ios has not.

@pragma('vm:entry-point')
void backgroundCallback() {
  BackgroundLocationTrackerManager.handleBackgroundUpdated((data) async {
    // do some stuff with data

  });
}
Future<void> main() async {
  

  WidgetsFlutterBinding.ensureInitialized();
  await BackgroundLocationTrackerManager.initialize(
    backgroundCallback,
    config: const BackgroundLocationTrackerConfig(
      loggingEnabled: true,

      androidConfig: AndroidConfig(
        notificationIcon: 'explore',
        trackingInterval: Duration(seconds: 30),
        distanceFilterMeters: null,
      ),
      iOSConfig: IOSConfig(
        activityType: ActivityType.FITNESS,
        distanceFilterMeters: null,
        restartAfterKill: true,
      ),
    ),
  );
}

Also flutter_background_service has limit for ios which described below:

Service terminated when app is in background (minimized) on iOS #

Keep in your mind, iOS doesn't have a long running service feature like Android. So, it's not possible to keep your application running when it's in background because the OS will suspend your application soon. Currently, this plugin provide onBackground method, that will be executed periodically by Background Fetch capability provided by iOS. It cannot be faster than 15 minutes and only alive about 15-30 seconds.

Reasons:
  • Blacklisted phrase (1): this plugin
  • Blacklisted phrase (1): i have same problem
  • Long answer (-1):
  • Has code block (-0.5):
  • Me too answer (2.5): i have same problem
  • Low reputation (1):
Posted by: Khayyam