Hi all,
I implemented a B4X app that use [B4X] OkHttpUtils2 framework (from @Erel) to download a json.
It is called repeatedly within a for each loop and all works well but the problem is the total download time.
THE PROBLEM
Each download takes 600ms and to populate all the items within my custom list view I need to call the method ".download" n times.
For example it is called 14 times to add 14 items to my clv. So 600ms x 14 = 8400ms = 8,4s
When the user touch the button he have to wait 8 / 9 seconds before the clv will be displayed.
During the app test more than one user is telling me: "nice app but it is too slow".
THE SOLUTION (that I trying)
Talking about B4A App version, while the user is watching the B4X splash screen (I set the splash sleep to 6 seconds) I do the download within the starter service, so when the user touch the button to open the clv, it is mostly populated and he don't have to wait much time.
So the good is that I do the long download only one time and than I cache the data within a runtime cache (using maps).
The bad is if the average time is 500 / 600ms for each download (get), the more the number of items increases, the more the total waiting time for the download (600ms x 14 items, 600ms x 18 items, and so on).
About this solution my questions are:
1) Are there any other alternative solutions ?
2) If this is the only solution, how to do this within the B4i version where the starter service doesn't exist ?
Thanks in advance for your help.
Luca.
I implemented a B4X app that use [B4X] OkHttpUtils2 framework (from @Erel) to download a json.
It is called repeatedly within a for each loop and all works well but the problem is the total download time.
THE PROBLEM
Each download takes 600ms and to populate all the items within my custom list view I need to call the method ".download" n times.
For example it is called 14 times to add 14 items to my clv. So 600ms x 14 = 8400ms = 8,4s
When the user touch the button he have to wait 8 / 9 seconds before the clv will be displayed.
During the app test more than one user is telling me: "nice app but it is too slow".
THE SOLUTION (that I trying)
Talking about B4A App version, while the user is watching the B4X splash screen (I set the splash sleep to 6 seconds) I do the download within the starter service, so when the user touch the button to open the clv, it is mostly populated and he don't have to wait much time.
So the good is that I do the long download only one time and than I cache the data within a runtime cache (using maps).
The bad is if the average time is 500 / 600ms for each download (get), the more the number of items increases, the more the total waiting time for the download (600ms x 14 items, 600ms x 18 items, and so on).
About this solution my questions are:
1) Are there any other alternative solutions ?
2) If this is the only solution, how to do this within the B4i version where the starter service doesn't exist ?
Thanks in advance for your help.
Luca.