Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IOS] The application automatically restarts after being swiped closed #2224

Open
hieuminh1810 opened this issue Dec 4, 2024 · 6 comments
Open
Labels

Comments

@hieuminh1810
Copy link

Your Environment

  • Plugin version: 4.18.0
  • Platform: iOS
  • OS version: 18.1
  • Device manufacturer / model: iPhone 16
  • React Native version (react-native -v): 0.75.4
  • Plugin config
const BACKGROUND_GEOLOCATION_CONFIG: Config = {
  reset: false,
  debug: false,
  distanceFilter: 30,
  autoSync: false,
  batchSync: false,
  // desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,

  //PERMISSION
  //disable dialog alert to avoid when Calling "BackgroundGeolocation.start" function causes app state to change (react-native-background-geolocation.md)
  disableLocationAuthorizationAlert: true,

  locationAuthorizationRequest: 'WhenInUse',

  //CUSTOM ALERT ON ANDROID
  // (Android 11+) Configure the dialog presented to the user when Always location permission is requested.
  backgroundPermissionRationale: {
    title: 'Use your location',
    message:
      '{applicationName} collects location data to enable order updates near your location even when the app is closed or not in use',
    positiveAction: 'Change to {backgroundPermissionOptionLabel}',
    negativeAction: 'Cancel',
  },
  //CUSTOM ALERT ON IOS
  locationAuthorizationAlert: {
    titleWhenNotEnabled: 'location-services not enabled',
    titleWhenOff: 'location-services OFF',
    instructions:
      'Locate Go collects location data to enable order updates near your location even when the app is closed or not in use',
    cancelButton: 'Cancel',
    settingsButton: 'Settings',
  },

  //android
  notification: {
    title: 'AAA',
    text: 'AAAA',
    sticky: true,
    smallIcon: 'mipmap/ic_notification',
    // largeIcon: 'mipmap/ic_notification_large',
    color: '#d64149',
    channelName: 'Background Geolocation Channel',
    // channelId: 'background_geolocation_channel',
    priority: BackgroundGeolocation.NOTIFICATION_PRIORITY_MIN,
  },
}

Expected Behavior

When I close the application, I want it not to restart automatically.

Actual Behavior

When I close the application then application will be restarted automatically.

Steps to Reproduce

  1. open application
  2. call once BackgroundGeolocation.ready
  3. call BackgroundGeolocation.start
  4. swipe to close(quit) application then the app will be restarted automatically

Context

when I try downgrade the version to 4.17.4, it works well
-> But 4.17.5, 4.17.6 and 4.18.0 not work :(

Debug logs

Logs





Screen.Recording.2024-12-05.at.1.12.16.AM.mov
@hieuminh1810
Copy link
Author

the version 4.17.4 works well but 4.17.5, 4.17.6, 4.18.0 alway automatically restarts my application 🙁

@christocracy
Copy link
Member

I have no idea what could cause the OS to automatically re-launch a terminated app.

But why does it matter?

@hieuminh1810
Copy link
Author

I don't know what changes were made in the newer versions, but version 4.17.4 does not have this issue

@hieuminh1810
Copy link
Author

hieuminh1810 commented Dec 23, 2024

hi @christocracy, I tried adding this line to config stopOnTerminate: Platform.isIos? false: undefined and it works well without re-launch the application

@hieuminh1810
Copy link
Author

if I change stopOnTerminate to true, then the app (IOS) will be re-launched after being swiped closed

@hieuminh1810 hieuminh1810 changed the title The application automatically restarts after being swiped closed [IOS] The application automatically restarts after being swiped closed Dec 23, 2024
Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants