-
Notifications
You must be signed in to change notification settings - Fork 276
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
Background location tracking not enable when app is terminated #987
Comments
This is a really bad idea. I have no idea what would happen on an iOS device booted in the background, since that's going to attempt to launch the mail app. On a sim, it's going to raise an exception immediately since the mail client isn't configured, which you'll
|
@christocracy I will be changing to get it from click of a button. I will post the updated log after changing it. |
If it works in the sim, the problem is your device (is wifi enabled?) or your environment (obstructions; mountains/building; cell towers). |
@christocracy Yes, wifi is enabled on the device and it definitely has internet connection in the route I drove now. Included here is the new log after moving emailLog to be trigger by user action. Logs
|
Clone the SampleApp repo and build it to your device. Do not look at the code, just clone and install on device. Use the "Advanced App" and tell me the username you select so I can observe your results. |
@christocracy I will do this in couple of days and give you the username. |
@christocracy User name is jeya-duraisamy5.
|
@christocracy I'm also facing same issue. Your Sample App is with ionic 3 and it works good, but tracking not working (iOS) when app is closed in ionic 4 in my app. |
The plugin doesn't know or care if you use Ionic 3, 4 or even if you don't use Ionic at all. Ionic version has no effect on the behaviour of the plugin. See wiki Debugging. |
@christocracy I checked the log in Xcode. When app is terminated TSBackgroundFetch stop Updating Location
|
So? |
Do you have any idea, why location not updated after app terminate? |
Have you read the docs for Config.stopOnTerminate? |
Yes, already I have set stopOnTerminate to false |
And what do the docs tell you about the behavior of ios after the app is terminated? |
Before an iOS app terminates, the plugin will ensure that a stationary geofence of stationaryRadius meters is created around the last known position. When the user moves beyond the stationary geofence (typically ~200 meters), iOS will completely reboot your application in the background, and the plugin will resume tracking. iOS maintains geofence monitoring at the OS level, in spite of application terminate / device reboot. For me tracking doesn't resume in background even I have travelled more than 2 KM |
Verify it works in the iOS simulator, while simulating location with Freeway Drive. |
Yes I have tested in iOS simulator but it doesn't work, here is my code, do I need to add any config parms? Can you please confirm
|
If it doesn’t work in sim, the problem is in your code. Make sure your app executes #ready no matter what, each time the app launches, being aware that your app may be launched automatically in the background by the os. |
I'm facing the same problem as @nijesh17 |
I do not have this issue in the SampleApp. Try it in the simulator. |
I just tried what you've mentioned: "executes #ready no matter what, each time the app launches" and it worked. Now I need to find out why executing after login into my app and in certain conditions, it does not work. What should I do in case I need to check if the logged user has some particular property and then start to collect his positions? |
The plugin persists its |
Do I need to add any other configuration other than this #987 (comment) to work on iOS? |
Config options are not the issue. I suggest you make a simple hello world app for yourself and first experiment in the simulator. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open. |
Closing this issue after a prolonged period of inactivity. Fell free to reopen this issue, if this still affecting you. |
@jeya-duraisamy Did you find the solution? I am also facing the same issue. |
Your Environment
cordova -v
): 9.0.3cordova platform ls
): 5.0.1#ready
:Expected Behavior
After the application is killed, location tracking should start working after driving 2-3 miles
Actual Behavior
After the application is killed, location tracking is not getting enabled even after driving for 15 miles. It enabled only when opening the app back again.
Steps to Reproduce
Note:
1. Background location tracking is getting enabled if I test the code with simulator running on iPhone Xr.
2. Ionic Appflow is used for building app to test on devices
Context
Background location tracking after the app is killed and the device is in motion
Debug logs
Logs - from emailLog
The text was updated successfully, but these errors were encountered: