JustWork
JustWork

Reputation: 1964

Web Api to Android app image transfer

I have an app that gets data from web api.

I am returning some info and image from web api. I have 2 options for image and these are:

I would want to know which is faster and better idea?

Thanks.

Upvotes: 1

Views: 867

Answers (1)

Matan L
Matan L

Reputation: 1027

I would say this depends on the way your application is workingand what it needs, The data itself is the same, so just think what would fit your app better,

I'll give some examples:

If the web api returns many responses with the same image and different info, you might want to use another server so you could use caching systems / cdn and than better perform your app

If it would help you that the "info" will reach to the app before the image (so you could load it first), you should also use the first option, and when the async proccess ends display the image (just an example...)

If you want to spare computing resources from the api servers every time it is used (encoding the image to base64 ect..) you should also use the first option

If lets say, you want to make sure that all the data comes at-once and non of the above is relevent to you, maybe you would prefer the second option

If you want to avoid async requests or having multiple requests every time may be the second option is better for you too

So, its just up to what your app needs :)

Hope i helped

Upvotes: 3

Related Questions