KJEjava48
KJEjava48

Reputation: 2055

Android : How to get large data above 20mb from server to android

In my android application when a user login from a new device i want to download all his data from the server database that may be more than 20mb in size.This data include bitmap images that are converted to string.When a user uploads a image what i done so far is i just convert this image to bitmap and then convert it to string and then save this to database,after that this data will save to server database by syncing.If the same user login from a new device i need to take all those data from server with a webservice.Right now i am using resttemplate to load this data, but the problem is when there is more than 20mb of data that mainly contains some image data the webservice may take more time based on the image size.Is there any better way to deal with images??

Upvotes: 0

Views: 192

Answers (2)

greenapps
greenapps

Reputation: 11214

Do not use bitmap images (what ever you mean by it) but jpg's. Dont convert them to base64 as the amount of data will increase by 30%. Dont save them in a database on your server but on the server file system as normal files.

Then just give twenly urls for twenty files to the Android client and let the Android client decide when and how to download the images from url.

Alternatively you can let your base64 encoded images in the database. Just send twenty ids or file names (for twenty files) to the Android client. Then let the Android client decide when it wants to download an image using an url with parameter id.

Upvotes: 1

fightingCoder
fightingCoder

Reputation: 594

You can use aws s3. The images can be saved in the s3 buckets, which provides us with the URL. While loading all the details in the app instead of loading the whole image, only the s3 URLs needed to be send. The images can be downloaded later while loading them into the imageviews using libraries like Picasso or glide.

Upvotes: 1

Related Questions