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

No locations sent when app is closed #19

Closed
lucaoliano opened this issue Apr 5, 2021 · 10 comments
Closed

No locations sent when app is closed #19

lucaoliano opened this issue Apr 5, 2021 · 10 comments

Comments

@lucaoliano
Copy link

Describe the bug
I'm developing an app that requires to push locations to BE even if the app has been closed, not simply put in background. I did several tests but I was not able to do this, the app it stops to send location when I close it. Is this the normal behavior, is it a bug or am I doing something wrong?

To Reproduce
Steps to reproduce the behavior:

  1. close the app

Expected behavior
The BE continue to receive locations even if the app has been closed, not in background

Smartphone (please complete the following information):

  • Device: iPhone 12 Pro in iPhone Simultator
  • OS: iOS 14.4
@diachedelic
Copy link
Collaborator

Hi @lucaoliano . I'm afraid that closing the app will indeed stop location updates. There may be a way to implement this for Android using services, but I am fairly certain this would never be possible on iOS.

@lucaoliano
Copy link
Author

@diachedelic thank you for the quick response. In the past I used this Cordova plugin and locations were sent with closed app both for iOS and Android

@diachedelic
Copy link
Collaborator

That's interesting, I did not know iOS supported that kind of background work. Communicating to a server is out of scope for this plugin. I actually wrote this plugin because I felt mauron85's plugin (which I used for two years) was too big and complex. Does mauron85's plugin no longer work for you?

@lucaoliano
Copy link
Author

I have an old app based on the 2.x version of mauron85's plugin and it works fine. Currently I'm rewriting the app, so I tried the 3.x version and I'm not able to send location with closed app, so I tried your plugin and it is the same.

Next tests are:

  • try cordova-background-geolocation-lt that is the original plugin that mauron85 forked to start his plugin . Unfortunately this plugin is free only for iOS and requires a license for Android
  • try mauron85 2.x on the new app

I will let you know if any of this test have success.

@lucaoliano
Copy link
Author

@diachedelic finally I found the mistake with mauron85's plugin v3.x, it started to send location with closed app after that I checked the Background processing capability in Xcode. I hope that this can help with development of your plugin, I I'd rather use your plugin since it hasn't unneeded complexity and is a native capacitor plugin.

@diachedelic
Copy link
Collaborator

I'm glad you got it working. My vision for this plugin is to provide a simple, lightweight alternative to the more feature rich plugins such as mauron85 and cordova-background-geolocation-lt. If those plugins cease to function with Capacitor I will consider incorporating such features.

@csotiMatyas
Copy link

@lucaoliano Hey, what was the issue with the mauron85's plugin v3.x, and how di d you solve it. And was it working with to?

@brandonporcel
Copy link

does anyone have a example code with ionic angular? didnt work for me

@satheshsat
Copy link

Got same issue on android 14. background location not sending after app is closed. Notification also removed.

@csotiMatyas
Copy link

@satheshsat the plugin doesnt work when the app is closed. What we ended up using is: transistorsoft background geolocation. Its payed plugin for android. But its the best documented plugin i have ever seen, if its of any value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants