Best way to upload cart items from android to server ? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

Best way to upload cart items from android to server ?

Hi, I have to upload cart items on the server. So, I have two ideas:- 1.) Upload items one by one using a loop. (in this it may happen that if any other user is also doing checkout( which will of course happen) his items and other people's items may not upload serial wise. But this is not an issue. it doesn't matter if it's not serialized. 2.) create a JSON array of those items in my cart and upload the whole JSON array on the server and parse it there one by one and keep inserting. ( with this method, I can use transactions to make sure every item gets uploaded.) So, which is the best way. if there is any third way. please mention it.

20th Oct 2021, 3:01 AM
Manjit Kumar
Manjit Kumar - avatar
1 Antwort
+ 1
The first one is a very bad idea. You will have to make multiple network calls which will be costlier on device side. The 2nd option is what people use generally.
20th Oct 2021, 2:03 PM
Rahul Kumar
Rahul Kumar - avatar