Forum Xamarin Xamarin.Android

Location update services and post request fail while app is in background

Hi,

The aim of my Android app is to store the location of the phone every 10 seconds on an external database.

I use Google Fused Location Api with RequestLocationUpdates to get the location every 10 seconds.
With the OnLocationChanged method, I post the location to an external url with HttpClient.PostAsync.

It is working for some moment but, while the app is in background, within 3 and 4 hours, it stops...and restart automatically hours after.
Sometimes, it can't post with HttpClient.PostAsync and catch this error : "Error : ConnectFailure (Connexion refused)".

If you have any ideas or other methods to do so, please help me :')

Sign In or Register to comment.