Closed paulCrp closed 3 years ago
I think i find something,
I've modified Location.cs File by added a bool value "locationServiceIsRunning" in properties dictionary. After, I allow the "Task run" only while locationServiceIsRunning is true. To finish, in AndroidLocation.cs i get/set my value.
This tricks do the job. When i reload the app after closing it, i don't recreate a new Location() if an previous one still running. I forked you're work and you can find my modification on: https://github.com/paulCrp/XamarinForms.LocationService/tree/develop if it help.
Again, thank you for you're example, is awsome and save me a lot of time.
PS: I'm only focused on Android version and it's possible IOS version need adjustement to fit with this little modification
Glad to know it is useful for you. I'll take a look at your fix on weekend and update the code. if you have time also you can send a pull request, I'll merge it to the branch.
Thanks.
Hello, If you start a geolocalisation thread and quit the application, when you reload it, if you stop the thread and restart a new one, it can't be stoped. The issues came from the launch of a new instance of MainActivity. It launch it twice. If you repeat the same operation, the app run 3 instance of MainActivity and crash. I've tried to solve it but mobile application are not my speciality. I'm going to try to go further. Anyway, this is an awesome exemple and save me a lot of time, thanks.