-
Notifications
You must be signed in to change notification settings - Fork 17
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
[Help Wanted]: iOS app doesn't restart for background location #309
Comments
|
Since the log is lengthy instead of pasting it here I created a Google doc and captured it here - has view permission Steps:
Please let me know if I can provide any additional info. Thanks. |
Yes, when you terminate an iOS app, the OS completely removes your app from memory. Everything stops, including the logs. You need to wait about 10s, while the simulator continues along the “freeway drive” route. Your app will come alive again after about 10s (witnessed by the debug notifications). As demonstrated in the following video: |
Also, you need to ensure your app always calls .ready(config) each and every time your app launches, even if launched automatically by the OS in the background. |
Thanks Chris. I have waited for several minutes actually, in my multiple tests, but the App does not restart. Upon manually restarting it will show a big location change to the new location, several miles away, much farther than the 100 meters in stationaryRadius. The App does call the ready function when it restarts which is why upon manual restart it starts sending location changes right away. Thank you for sharing the demo link Chris - very well put together. As demonstrated in the video, that is what I expect to happen, for the app to restart after stationaryradius is crossed. But that is what doesn't seem to be happening. Not sure why that is the case. |
It works as-expected for me using the /example/react app in this repo. capacitor-stop-on-terminate.mp4 |
Thanks Chris. I will try to run your Angular example code as that's what I am using. It should work there and help confirm the issue with my App. |
Quick update on this. I cloned the repository and since I am on Capacitor 6 (not moved to 7 yet) I did a checkout |
@christocracy sorry for the delay - finally got back to it while I am still traveling. I did a clean clone and followed the instructions in the Readme file under example/angular. Steps followed -
I added the GOOGLE_MAP_API_KEY to the environment.ts file to see if that helps address
Ionic Info output is below
Unless I am missing something I followed the instructions in the Readme. Please let me know what I may be missing here or if I can provide additional info to help debug the demo app. Thanks, |
@christocracy any thoughts on the issue above in running the example code as is, following the steps outlined? Please let me know if I am missing something obvious here. Thanks. |
Required Reading
Plugin Version
capacitor-background-geolocation 6.1.4 capacitor-background-fetch 6.0.1
Mobile operating-system(s)
What do you require assistance about?
I have the App running in iOS simulator on Mac and simulating a drive. When the App is in foreground or put in background the location updates are recorded successfully. However when the App is closed the location updates stop.
Expected Behavior:
After stationaryRadius is crossed the App should restart and start sending location
Actual Behavior:
The App doesn't restart after terminated, even after waiting for a while. If the App is restarted manually then the updated location shows again, far in excess of the 100 meters specified in stationaryRadius
Ionic info
Ionic:
Ionic CLI : 7.1.1 (/Users/userx/.nvm/versions/node/v20.2.0/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 6.7.5
@angular-devkit/build-angular : 16.2.16
@angular-devkit/schematics : 16.2.16
@angular/cli : 16.2.16
@ionic/angular-toolkit : 12.1.1
Capacitor:
Capacitor CLI : 6.2.0
@capacitor/android : 6.2.0
@capacitor/core : 6.2.0
@capacitor/ios : 6.2.0
Cordova:
Cordova CLI : 12.0.0 ([email protected])
Cordova Platforms : android 9.1.0, browser 6.0.0, ios 6.2.0
Cordova Plugins : cordova-plugin-ionic-webview 4.2.1, (and 3 other plugins)
Utility:
cordova-res : 0.15.4
native-run : 2.0.1
System:
ios-sim : 8.0.2
NodeJS : v20.2.0 (/Users/userx/.nvm/versions/node/v20.2.0/bin/node)
npm : 9.6.6
OS : macOS Unknown
Xcode : Xcode 16.0 Build version 16A242d
Other Info
It shouldn't matter but I am using iOS 17.5 on emulators - tried for iPhone 15 Pro Max and 13 Pro
App permission is set to Always
Thanks,
Sanjay.
[Optional] Plugin Code and/or Config
[Optional] Relevant log output
The text was updated successfully, but these errors were encountered: