Closed ibrahimakar closed 1 year ago
Are you aware that an iOS app needs to move at least 200 meters after being terminated before tracking resumes?
See API docs Config.stopOnTerminate
.
Thank you for reply, Yes, app starts at background and i show the local moving notifications after 200m walks. i think there is no problem to wake up app, but in onLocation listener i call the my post api but there is no action there. On the other hand i emailed the logs, because i added Log in onLocation listener and only shown and post api success when i open the app?
I think, i missed something at configuration. But i dont know what is.
=== EDIT ====
In Simulator everything is OK. when terminated app, and sim in Freeway Drive Loc, it wakes up and posting server
=== EDIT === i recorded new action log; Until 2022-11-23 18:13:26.400 when the application is terminated and then the application is opened and backgrounded..
I just added a BackgroundGeolocation.logger.debug("*** [onLocation]")
in my demo app and went for a walk around the neighbourhood after first launching the app then terminating it.
Arriving home, I see all my log messages in the logs.
2022-11-23 09:43:28.248 ℹ️-[TSLocationManager log:message:] *** [onLocation]: 45.51885302539379, -73.60050129930512
I also see that my data arrived at my server.
I suggest you ensure that BackgroundGeolocation.ready(config)
is called each time your app launches, no matter what.
Also note: in my demo app, I draw map markers on the map using onLocation
. If this event somehow wasn't being called, I wouldn't see map-markers on the map. It would be very obvious that something was wrong.
I also think, plugin has no problem. i think there is missing part my configuration (such as I just realized, I didn't choose a background prroccessing mode on infi.plist) and i went for a tip around the neighbourhood. and crate an new log but again there is no record in db. background-geolocation 4.log
can you share an code snippet, which is post external http service used in onLocation listener? or i know there are lots of information on documentation and i read lots of them about my request, can you let me know if there is a critical setting that I need to pay attention to?
It confuses me that there is no problem while in the simulator but device is
i noticed log inserted ║ -[TSHttpService finish:error:] Success: 0 but i did not use http service of plugin.
also, I opened the app and closed it right away and then went around, that could be a problem? these are notifications of my last trip
I have no idea what your problem is.
I suggest you build a simple Hello World app and test it.
@ibrahimakar did you find any solutions ? i have exactly the same problem. It seems like, onLocation method is not being called in background (when app is killed). However, push notifications with every informations are received when app is killed.
I am in debug mode, can not figure out what part of configuration i am missing .. I just created a bare new project, that is the only thing that i am doing in the app as it is a POC ..
Publish your “POC” tk a public repo so I can see it.
hi @talal-tilted yes i found a solution, but i dont know it is relevant with this situation i actually know onLocation subscrioption work succesfully but i didnt post location with my api. i used BackgroundGeolocation.startBackgroundTask() got sending location to api and it works.
Thanks @christocracy and @ibrahimakar for quick reply. My problem was a bit different, i fixed it. The problem was the React Native packager not connecting / receiving log. So i took my laptop and device in a car and took a ride and everything's was working well !
Thanks again !
Your Environment
react-native -v
): ^0.69.7Plugin config