transistorsoft / flutter_background_geolocation

Sophisticated, battery-conscious background-geolocation & geofencing with motion-detection
https://www.transistorsoft.com/shop/products/flutter-background-geolocation
Other
647 stars 240 forks source link

Background Process is Getting Killed in iOS v16.4.1 #1021

Closed csarigumba closed 1 year ago

csarigumba commented 1 year ago

In my Flutter app, we are running a countdown timer and using this plugin to make the timer continue running while the application is in the background (i.e. when the user minimizes the application).

It was working fine yesterday, but today I updated my iOS to version 16.4.1 and noticed that the background process is no longer working when the application is put in the background.

Your Environment

• No issues found!


* Plugin config:
```dart
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter_background_geolocation/flutter_background_geolocation.dart'
    as bg;
import 'package:keyboard_actions/external/platform_check/platform_check.dart';

part 'background_geolocation_state.dart';

class BackgroundGeolocationCubit extends Cubit<BackgroundGeolocationState> {
  BackgroundGeolocationCubit() : super(const BackgroundGeolocationState());

  onStart() {
    final isIos = PlatformCheck.isIOS;
    if (!isIos) {
      // No need to turn on background service if its not iOS.
      return;
    }

    bg.BackgroundGeolocation.onLocation(_onLocation);
    bg.BackgroundGeolocation.onMotionChange(_onMotionChange);
    bg.BackgroundGeolocation.onActivityChange(_onActivityChange);
    bg.BackgroundGeolocation.onConnectivityChange(_onConnectivityChange);

    bg.BackgroundGeolocation.ready(bg.Config(
      desiredAccuracy: bg.Config.DESIRED_ACCURACY_HIGH,
      distanceFilter: 10.0,
      stopOnTerminate: true,
      preventSuspend: true,
      startOnBoot: false,
      debug: true,
      // debug: true, Note: just enabled during debugging from local environment.
      logLevel: bg.Config.LOG_LEVEL_INFO,
      allowIdenticalLocations: true,
      reset: true,
    )).then((bg.State state) {
      print("Done configuring background_geolocation.");
    });

    bg.BackgroundGeolocation.start().then((bg.State state) {
      print('[start] success $state');
    });
  }

  void onStop() {
    if (!PlatformCheck.isIOS) {
      // No need to turn on background service if its not iOS.
      return;
    }

    bg.BackgroundGeolocation.stop().then((bg.State state) {
      print('[stop] success: $state');
      bg.BackgroundGeolocation.setOdometer(0.0);
    });
  }

  void _onLocation(bg.Location location) {
    print('[location] - $location');
  }

  void _onMotionChange(bg.Location location) {
    print('[motionchange] - $location');
  }

  void _onActivityChange(bg.ActivityChangeEvent event) {
    print('[activitychange] - $event');
  }

  void _onConnectivityChange(bg.ConnectivityChangeEvent event) {
    print('$event');
  }
}

Expected Behavior

The timer should continue running even though the application is minimized (background)

Actual Behavior

Application is stopped. The timer will resume once you open the app again (resume in Foreground)

Steps to Reproduce

  1. Open my flutter app
  2. Start the timer
  3. Minimize the application (move it to Background)
  4. Observe the logs. It will stopped running during 30seconds+

Context

In my flutter app, we are running a countdown timer and using this plugin to make the timer continuously running while the application is in the background (user will minimize the application).

Debug logs


ℹ️-[TSLocationManager on:success:failure:] location
ℹ️-[TSLocationManager on:success:failure:] motionchange
ℹ️-[TSLocationManager on:success:failure:] activitychange
ℹ️-[TSHttpService onConnectivityChange:]
🔵-[TSLocationManager ready]
⚠️-[TSLocationManager log:message:] #ready already called.  Redirecting to #setConfig
⚠️-[TSLocationManager log:message:] #ready already called.  Redirecting to #setConfig
ℹ️-[TSLocationManager doStart:] trackingMode: 1
🎾-[TSGeofenceManager start]
🎾-[SOMotionDetector startDetection]
🔵-[TSLocationManager setPace:] 0
🎾-[TSLocationManager startUpdatingLocation] Location-services: ON
⚠️-[TSLocationManager start] Already started (ignored)
⚠️-[TSLocationManager start] Already started (ignored)
ℹ️+[LocationAuthorization run:onCancel:] status: 3
🎾-[TSLocationManager startMonitoringBackgroundFetch] BackgroundFetch: ON
[TSBackgroundFetch scheduleBGAppRefresh] com.transistorsoft.fetch
✅-[SOMotionDetector startDetection]_block_invoke Enabled M7 MotionActivity updates
flutter: Done configuring background_geolocation.
flutter: Done configuring background_geolocation.
flutter: Done configuring background_geolocation.
flutter: [ConnectivityChangeEvent connected: true]
flutter: [ConnectivityChangeEvent connected: true]
flutter: [ConnectivityChangeEvent connected: true]
flutter: [location] - [Location {coords: {speed_accuracy: -1.0, speed: -1.0, longitude: 123.88061811452519, ellipsoidal_altitude: 75.9, floor: 2146959360, heading_accuracy: -1.0, latitude: 10.296951293945312, accuracy: 51.3, altitude_accuracy: 16.9, altitude: 13.3, heading: -1.0}, sample: true, extras: {}, is_moving: false, odometer: 28.7, uuid: 8513F8E2-7571-4ED0-8EED-0868E9954691, activity: {type: unknown, confidence: 100}, battery: {level: 1.0, is_charging: true}, timestamp: 2023-04-21T13:54:04.946Z}]
flutter: [location] - [Location {coords: {speed_accuracy: -1.0, speed: -1.0, longitude: 123.88061811452519, ellipsoidal_altitude: 75.9, floor: 2146959360, heading_accuracy: -1.0, latitude: 10.296951293945312, accuracy: 51.3, altitude_accuracy: 16.9, altitude: 13.3, heading: -1.0}, sample: true, extras: {}, is_moving: false, odometer: 28.7, uuid: 8513F8E2-7571-4ED0-8EED-0868E9954691, activity: {type: unknown, confidence: 100}, battery: {level: 1.0, is_charging: true}, timestamp: 2023-04-21T13:54:04.946Z}]
flutter: [location] - [Location {coords: {speed_accuracy: -1.0, speed: -1.0, longitude: 123.88061811452519, ellipsoidal_altitude: 75.9, floor: 2146959360, heading_accuracy: -1.0, latitude: 10.296951293945312, accuracy: 51.3, altitude_accuracy: 16.9, altitude: 13.3, heading: -1.0}, sample: true, extras: {}, is_moving: false, odometer: 28.7, uuid: 8513F8E2-7571-4ED0-8EED-0868E9954691, activity: {type: unknown, confidence: 100}, battery: {level: 1.0, is_charging: true}, timestamp: 2023-04-21T13:54:04.946Z}]
flutter: [start] success [State enabled: true, isMoving: false, trackingMode: 1, desiredAccuracy: -1, distanceFilter: 10.0, odometer: 28.74283727281111, schedulerEnabled: false, foregroundService: null]
flutter: [start] success [State enabled: true, isMoving: false, trackingMode: 1, desiredAccuracy: -1, distanceFilter: 10.0, odometer: 28.74283727281111, schedulerEnabled: false, foregroundService: null]
flutter: totalStepCountValue: 36, _stepsDecrementor: 36, _onDiningStepCount: 0
flutter: totalStepCountValue: 36, _stepsDecrementor: 36, _onDiningStepCount: 0
flutter: [start] success [State enabled: true, isMoving: false, trackingMode: 1, desiredAccuracy: -1, distanceFilter: 10.0, odometer: 28.74283727281111, schedulerEnabled: false, foregroundService: null]
flutter: [motionchange] - [Location {coords: {speed_accuracy: -1.0, speed: -1.0, longitude: 123.88061811452519, ellipsoidal_altitude: 75.9, floor: null, heading_accuracy: -1.0, latitude: 10.296957196725742, accuracy: 51.3, altitude_accuracy: 16.9, altitude: 13.3, heading: -1.0}, extras: {}, is_moving: false, event: motionchange, odometer: 28.7, uuid: E73B9FF9-C729-4F6C-961F-8CDE3CC7E064, activity: {type: unknown, confidence: 100}, battery: {level: 1.0, is_charging: true}, timestamp: 2023-04-21T13:54:04.613Z}]
flutter: [motionchange] - [Location {coords: {speed_accuracy: -1.0, speed: -1.0, longitude: 123.88061811452519, ellipsoidal_altitude: 75.9, floor: null, heading_accuracy: -1.0, latitude: 10.296957196725742, accuracy: 51.3, altitude_accuracy: 16.9, altitude: 13.3, heading: -1.0}, extras: {}, is_moving: false, event: motionchange, odometer: 28.7, uuid: E73B9FF9-C729-4F6C-961F-8CDE3CC7E064, activity: {type: unknown, confidence: 100}, battery: {level: 1.0, is_charging: true}, timestamp: 2023-04-21T13:54:04.613Z}]
flutter: [motionchange] - [Location {coords: {speed_accuracy: -1.0, speed: -1.0, longitude: 123.88061811452519, ellipsoidal_altitude: 75.9, floor: null, heading_accuracy: -1.0, latitude: 10.296957196725742, accuracy: 51.3, altitude_accuracy: 16.9, altitude: 13.3, heading: -1.0}, extras: {}, is_moving: false, event: motionchange, odometer: 28.7, uuid: E73B9FF9-C729-4F6C-961F-8CDE3CC7E064, activity: {type: unknown, confidence: 100}, battery: {level: 1.0, is_charging: true}, timestamp: 2023-04-21T13:54:04.613Z}]
✅-[TSLocationManager locationManager:didUpdateLocations:] Acquired motionchange position: <+10.29695720,+123.88061811> +/- 51.33m (speed -1.00 mps / course -1.00) @ 4/21/23, 21:54:04 Philippine Standard Time
flutter: [location] - [Location {coords: {speed_accuracy: -1.0, speed: -1.0, longitude: 123.88061811452519, ellipsoidal_altitude: 75.9, floor: null, heading_accuracy: -1.0, latitude: 10.296957196725742, accuracy: 51.3, altitude_accuracy: 16.9, altitude: 13.3, heading: -1.0}, extras: {}, is_moving: false, event: motionchange, odometer: 28.7, uuid: E73B9FF9-C729-4F6C-961F-8CDE3CC7E064, activity: {type: unknown, confidence: 100}, battery: {level: 1.0, is_charging: true}, timestamp: 2023-04-21T13:54:04.613Z}]
🔵-[TSLocationManager startMonitoringStationaryRegion:radius:] Radius: 76
flutter: [location] - [Location {coords: {speed_accuracy: -1.0, speed: -1.0, longitude: 123.88061811452519, ellipsoidal_altitude: 75.9, floor: null, heading_accuracy: -1.0, latitude: 10.296957196725742, accuracy: 51.3, altitude_accuracy: 16.9, altitude: 13.3, heading: -1.0}, extras: {}, is_moving: false, event: motionchange, odometer: 28.7, uuid: E73B9FF9-C729-4F6C-961F-8CDE3CC7E064, activity: {type: unknown, confidence: 100}, battery: {level: 1.0, is_charging: true}, timestamp: 2023-04-21T13:54:04.613Z}]
🔵-[TSLocationManager beginHeartbeat] 60
flutter: [location] - [Location {coords: {speed_accuracy: -1.0, speed: -1.0, longitude: 123.88061811452519, ellipsoidal_altitude: 75.9, floor: null, heading_accuracy: -1.0, latitude: 10.296957196725742, accuracy: 51.3, altitude_accuracy: 16.9, altitude: 13.3, heading: -1.0}, extras: {}, is_moving: false, event: motionchange, odometer: 28.7, uuid: E73B9FF9-C729-4F6C-961F-8CDE3CC7E064, activity: {type: unknown, confidence: 100}, battery: {level: 1.0, is_charging: true}, timestamp: 2023-04-21T13:54:04.613Z}]
🔴-[TSLocationManager stopUpdatingLocation]
🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 51.3
🎾-[TSLocationManager startMonitoringSignificantLocationChanges]
✅-[BackgroundTaskManager createBackgroundTask] 37
✅-[LocationDAO unlock]_block_invoke UNLOCKED ALL RECORDS
✅-[TSLocationManager persistLocation:]_block_invoke INSERT: E73B9FF9-C729-4F6C-961F-8CDE3CC7E064
⚠️-[TSLocationManager log:message:] #ready already called.  Redirecting to #setConfig
⚠️-[TSLocationManager log:message:] #ready already called.  Redirecting to #setConfig
flutter: Done configuring background_geolocation.
[log] onChange(DiningCubit, Change { currentState: DiningState(DiningScreenStatus.loaded, [PhotoItem(0, okkk, , 5, /var/mobile/Containers/Data/Application/002769D6-3DE7-4D7E-8A4B-865CF2908ECC/Documents/dnRfx83Th10mcQD.jpg, , PhotoType.unknown, [], false, true, true, true)], PhotoItem(0, okkk, , 5, /var/mobile/Containers/Data/Application/002769D6-3DE7-4D7E-8A4B-865CF2908ECC/Documents/dnRfx83Th10mcQD.jpg, , PhotoType.unknown, [], false, true, true, true), DiningStatus.inprogress, FoodSelfieStatus.pictureTaken, DinerType.host, Instance of 'DiningVariablesState', Instance of 'TableDetail', /var/mobile/Containers/Data/Application/002769D6-3DE7-4D7E-8A4B-865CF2908ECC/Documents/dnRfx83Th10mcQD.jpg, CustomPlaceDetail(id: 257, details: Details(photos: [https://plt-dev-gamification-bucket.s3.us-east-1.amazonaws.com/dining/681/food-image_1666356003093/VAZIWc3dwahqjRR.jpg], addressComponents: [PlatoAddressComponents(longName: Cebu Institute of Technology University, types: [point_of_interest, establishment]), PlatoAddressComponents(longName: Cebu City, types: [locality, political]), PlatoAddressComponents(longName: Cebu, types: [administrative_area_level_2, political]), PlatoAddressComponents(longName: Central Visayas, types: [administrative_area_level_1, political]), PlatoAddressComponents(longName: Philippines, types: [country, political])], formattedAddress: Cebu Institute of Technology University, Cebu City, Cebu, Philippines, geometry: PlatoGeometry(location: PlatoLocation(lat: 10.2976633, lng: 123.8800814)), internationalPhoneNumber: No phone number available, name: BINUGOK, platoOpeningHours: PlatoOpeningHours(openNow: true,  periods: [Periods(close: PlatoClose(day: 0, time: 2200), open: PlatoOpen(day: 0, time: 1000)), Periods(close: PlatoClose(day: 1, time: 2200), open: PlatoOpen(day: 1, time: 1000)), Periods(close: PlatoClose(day: 2, time: 2200), open: PlatoOpen(day: 2, time: 1000)), Periods(close: PlatoClose(day: 3, time: 2200), open: PlatoOpen(day: 3, time: 1000)), Periods(close: PlatoClose(day: 4, time: 2200), open: PlatoOpen(day: 4, time: 1000)), Periods(close: PlatoClose(day: 5, time: 2200), open: PlatoOpen(day: 5, time: 1000)), Periods(close: PlatoClose(day: 6, time: 2200), open: PlatoOpen(day: 6, time: 1000))]), placeId: ChIJ3cYD_d2dqTMRcRxv2BO5otw, rating: 5, types: [restaurant, food, establishment], userRatingsTotal: 1, vicinity: Cebu Institute of Technology University, Cebu City, priceLevel: 0)), Instance of 'UpdateDining', FoodItemSubmitReviewStatus.unknown, ReceiptConfirmationStatus.initialized, ReceiptRejectionStatus.unknown, , [], FoodItemPhotoCaptureStatus.inprogress, RestaurantReviewStatus.unknown, SocialSharingStatus.unknown, UploadToServerStatus.inprogress, {}, false, false, 0, [], FoodPhotoValidyStatus.unknown, PhotoItem(0, Item name, , 5, , , PhotoType.unknown, [], false, true, false, true), []), nextState: DiningState(DiningScreenStatus.loaded, [PhotoItem(1188, okkk, , 5, , https://plt-dev-gamification-bucket.s3.us-east-1.amazonaws.com/dining/1164/food-image_1682085245070/0stAfh2t01hh84K.jpg, PhotoType.unknown, [https://plt-dev-gamification-bucket.s3.us-east-1.amazonaws.com/dining/1164/food-image_1682085245070/0stAfh2t01hh84K.jpg], false, true, true, true)], PhotoItem(0, okkk, , 5, /var/mobile/Containers/Data/Application/002769D6-3DE7-4D7E-8A4B-865CF2908ECC/Documents/dnRfx83Th10mcQD.jpg, , PhotoType.unknown, [], false, true, true, true), DiningStatus.inprogress, FoodSelfieStatus.pictureTaken, DinerType.host, Instance of 'DiningVariablesState', Instance of 'TableDetail', /var/mobile/Containers/Data/Application/002769D6-3DE7-4D7E-8A4B-865CF2908ECC/Documents/dnRfx83Th10mcQD.jpg, CustomPlaceDetail(id: 257, details: Details(photos: [https://plt-dev-gamification-bucket.s3.us-east-1.amazonaws.com/dining/681/food-image_1666356003093/VAZIWc3dwahqjRR.jpg], addressComponents: [PlatoAddressComponents(longName: Cebu Institute of Technology University, types: [point_of_interest, establishment]), PlatoAddressComponents(longName: Cebu City, types: [locality, political]), PlatoAddressComponents(longName: Cebu, types: [administrative_area_level_2, political]), PlatoAddressComponents(longName: Central Visayas, types: [administrative_area_level_1, political]), PlatoAddressComponents(longName: Philippines, types: [country, political])], formattedAddress: Cebu Institute of Technology University, Cebu City, Cebu, Philippines, geometry: PlatoGeometry(location: PlatoLocation(lat: 10.2976633, lng: 123.8800814)), internationalPhoneNumber: No phone number available, name: BINUGOK, platoOpeningHours: PlatoOpeningHours(openNow: true,  periods: [Periods(close: PlatoClose(day: 0, time: 2200), open: PlatoOpen(day: 0, time: 1000)), Periods(close: PlatoClose(day: 1, time: 2200), open: PlatoOpen(day: 1, time: 1000)), Periods(close: PlatoClose(day: 2, time: 2200), open: PlatoOpen(day: 2, time: 1000)), Periods(close: PlatoClose(day: 3, time: 2200), open: PlatoOpen(day: 3, time: 1000)), Periods(close: PlatoClose(day: 4, time: 2200), open: PlatoOpen(day: 4, time: 1000)), Periods(close: PlatoClose(day: 5, time: 2200), open: PlatoOpen(day: 5, time: 1000)), Periods(close: PlatoClose(day: 6, time: 2200), open: PlatoOpen(day: 6, time: 1000))]), placeId: ChIJ3cYD_d2dqTMRcRxv2BO5otw, rating: 5, types: [restaurant, food, establishment], userRatingsTotal: 1, vicinity: Cebu Institute of Technology University, Cebu City, priceLevel: 0)), Instance of 'UpdateDining', FoodItemSubmitReviewStatus.unknown, ReceiptConfirmationStatus.initialized, ReceiptRejectionStatus.unknown, , [], FoodItemPhotoCaptureStatus.inprogress, RestaurantReviewStatus.unknown, SocialSharingStatus.unknown, UploadToServerStatus.inprogress, {}, false, false, 0, [], FoodPhotoValidyStatus.unknown, PhotoItem(0, Item name, , 5, , , PhotoType.unknown, [], false, true, false, true), []) })
⚠️-[TSLocationManager log:message:] #ready already called.  Redirecting to #setConfig
flutter: Done configuring background_geolocation.
⚠️-[TSLocationManager log:message:] #ready already called.  Redirecting to #setConfig
flutter: Done configuring background_geolocation.
⚠️-[TSLocationManager start] Already started (ignored)
⚠️-[TSLocationManager start] Already started (ignored)
⚠️-[TSLocationManager start] Already started (ignored)
⚠️-[TSLocationManager start] Already started (ignored)
flutter: Done configuring background_geolocation.
flutter: totalStepCountValue: 36, _stepsDecrementor: 36, _onDiningStepCount: 0
flutter: [start] success [State enabled: true, isMoving: false, trackingMode: 1, desiredAccuracy: -1, distanceFilter: 10.0, odometer: 28.74283727281111, schedulerEnabled: false, foregroundService: null]
flutter: totalStepCountValue: 36, _stepsDecrementor: 36, _onDiningStepCount: 0
flutter: [start] success [State enabled: true, isMoving: false, trackingMode: 1, desiredAccuracy: -1, distanceFilter: 10.0, odometer: 28.74283727281111, schedulerEnabled: false, foregroundService: null]
flutter: totalStepCountValue: 36, _stepsDecrementor: 36, _onDiningStepCount: 0
flutter: [start] success [State enabled: true, isMoving: false, trackingMode: 1, desiredAccuracy: -1, distanceFilter: 10.0, odometer: 28.74283727281111, schedulerEnabled: false, foregroundService: null]
flutter: totalStepCountValue: 36, _stepsDecrementor: 36, _onDiningStepCount: 0
flutter: [start] success [State enabled: true, isMoving: false, trackingMode: 1, desiredAccuracy: -1, distanceFilter: 10.0, odometer: 28.74283727281111, schedulerEnabled: false, foregroundService: null]
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 0), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 1) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 1), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 2) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 2), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 3) })
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 3), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 4) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 4), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 5) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 5), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 6) })
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 6), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 7) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 7), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 8) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 8), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 9) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 9), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 10) })
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
🔵-[BackgroundTaskManager startPreventSuspendTimer:] BG time remaining: 20 | Total tasks: 1
🔵-[TSLocationManager onSuspend:] enabled? 1)
[Snapshotting] Snapshotting a view (0x10a8bc000, UIKeyboardImpl) that is not in a visible window requires afterScreenUpdates:YES.
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 10), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 11) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 11), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 12) })
flutter: [CountlyFlutter] DEBUG: _recordFlutterError, Flutter error caught by Countly:
flutter: [CountlyFlutter] DEBUG: _internalRecordError, Exception : HttpException: Invalid statusCode: 403, uri = https://plt-dev-gamification-bucket.s3.us-east-1.amazonaws.com/dining/681/food-image_1666356003093/VAZIWc3dwahqjRR.jpg
flutter: [CountlyFlutter] DEBUG:
_internalRecordError, Stack :
flutter: [CountlyFlutter] DEBUG: Calling "logException":[HttpException: Invalid statusCode: 403, uri = https://plt-dev-gamification-bucket.s3.us-east-1.amazonaws.com/dining/681/food-image_1666356003093/VAZIWc3dwahqjRR.jpg
] nonfatal:[true]: with segmentation count:[0]
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 12), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 13) })
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 13), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 14) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 14), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 15) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 15), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 16) })
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 16), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 17) })
flutter: [activitychange] - [ActivityChangeEvent still (100%)]
flutter: [activitychange] - [ActivityChangeEvent still (100%)]
flutter: [activitychange] - [ActivityChangeEvent still (100%)]
flutter: [activitychange] - [ActivityChangeEvent still (100%)]
flutter: [activitychange] - [ActivityChangeEvent still (100%)]
flutter: [activitychange] - [ActivityChangeEvent still (100%)]
flutter: [activitychange] - [ActivityChangeEvent still (100%)]
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 17), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 18) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 18), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 19) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 19), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 20) })
🔵-[BackgroundTaskManager onPreventSuspendTimer:] Prevent-suspend timer fired! (bg time remaining: 20.228372)
ℹ️+[LocationAuthorization run:onCancel:] status: 3
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 20), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 21) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 21), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 22) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 22), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 23) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 23), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 24) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 24), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 25) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 25), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 26) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 26), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 27) })
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 27), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 28) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 28), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 29) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 29), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 30) })
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
flutter: [activitychange] - [ActivityChangeEvent still (33%)]
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 30), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 31) })
flutter: [activitychange] - [ActivityChangeEvent still (100%)]
flutter: [activitychange] - [ActivityChangeEvent still (100%)]
flutter: [activitychange] - [ActivityChangeEvent still (100%)]
flutter: [activitychange] - [ActivityChangeEvent still (100%)]
flutter: [activitychange] - [ActivityChangeEvent still (100%)]
flutter: [activitychange] - [ActivityChangeEvent still (100%)]
flutter: [activitychange] - [ActivityChangeEvent still (100%)]
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 31), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 32) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 32), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 33) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 33), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 34) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 34), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 35) })
[BackgroundTask] Background Task 37 ("Called by Runner, from -[BackgroundTaskManager createBackgroundTask]"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(_:) for your task in a timely manner to avoid this.
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 35), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 36) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 36), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 37) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 37), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 38) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 38), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 39) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 39), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 40) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 40), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 41) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 41), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 42) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 42), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 43) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 43), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 44) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 44), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 45) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 45), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 46) })
[BackgroundTask] Background Task 54 ("Flutter debug task"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(_:) for your task in a timely manner to avoid this.
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 46), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 47) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 47), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 48) })
[BackgroundTask] Background task still not ended after expiration handlers were called: <_UIBackgroundTaskInfo: 0x280b6bb00>: taskID = 37, taskName = Called by Runner, from -[BackgroundTaskManager createBackgroundTask], creationTime = 2569 (elapsed = 48). This app will likely be terminated by the system. Call UIApplication.endBackgroundTask(_:) to avoid this.
⚠️-[BackgroundTaskManager createBackgroundTask]_block_invoke FORCE KILL BACKGROUND TASK: 37, remaining time: 4.014507
✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 37 OF (
    37
)
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 48), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 49) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 49), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 50) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 50), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 51) })
[log] onChange(TimerCubit, Change { currentState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 51), nextState: TimerState(TimerStatus.running, 480, ApiPostingStatus.running, LocationCheckStatus.running, ReminderStatus.unknown, 52) })
christocracy commented 1 year ago

Plugin version: flutter_background_geolocation: '^4.8.1'

iOS 16.4 made a big change to location API. You should use the latest version of the plugin. You might also want to try using showsBackgroundLocationIndicator: true.

christocracy commented 1 year ago

Latest version is v4.10.3. See CHANGELOG

csarigumba commented 1 year ago

hey @christocracy,

thanks for the quick response! I was able to confirm that it works well in the latest version v4.10.3. Closing this issue.