question

GaneshGebhard-8778 avatar image
0 Votes"
GaneshGebhard-8778 asked WenyanZhang-MSFT commented

Xamarin.Forms - Keep uploading image besides using the app

Hey!

I have a Xamarin.Forms app for Android and iOS. The users can take pictures, adjust them a bit and send them to a server when done.
Now two problems can occur:
- When the connection is bad, the image is not send.
- When multiple users are sending their pictures to the server at the same time, it can take too long in which the image is not send and the app might crash because of a bad connection exception.

Now I'm looking for a solution where the image are 'parked' somewhere to be uploaded, in which the app keeps trying the upload even though the connection is bad, or at least is able to perform the upload when everything is fine again.
In general: I need a fail-safe for the image upload, so that by the end of the day all images are uploaded to the server (even if it takes an hour to do so).

I'm not sure what the possibilities are for this or if there are examples on how to construct this. I hope someone is able to guide me in this.

Best,

dotnet-xamarin
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

In my opinion, you could save the adjusted pictures into local storage, then upload them in the background.
For Android, you could try to Create Android Services, it can perform long-running operations in the background.
For iOS, you could try to use Background transfer and NSURLSession in Xamarin.iOS, it allows HTTP and HTTPS uploads or downloads, performed in the background.

0 Votes 0 ·

0 Answers