1

How would you approach this problem:

My app should download different packages of pictures (containing up to 300 pngs, each about 20 kb) and store the pictures on the phone, so i can display them.

I want to upload the pictures somewhere online, so I can change them every time and the user can enjoy the newest pictures. (I upload the pictures not with the app) I read that storing them in a sqlite db isn't the best option.

At the moment I am storing the pictures in the app, but then I don't know how I can upload and replace pictures on all apps immediately without the need of updating the whole app.

I don't need code or stuff, so don't waste your precious time on that, just some general hints where and how you would store the pictures online, and how android can download the pictures easily.

Enamul Hassan
  • 5,266
  • 23
  • 39
  • 56
Simon
  • 63
  • 1
  • 6
  • Usually best practice questions are not well received in SO, so it'd be better you you shared at least a bit of code to show what you've tried so far. Bu anyway, take a look at the picasso library, it's an elegant way of solving your problem. – Edson Menegatti Jul 07 '15 at 19:21
  • you can upload and save the image in either web or file system and save the corresponding path in sqllite db. to change the picture by you, you can save it in filesystem of your server where the app can connect and you can change them there. download would be just reading the images/buffer from the path stored in sqlite db during upload. – Jimmy Jul 07 '15 at 19:21
  • I will write to you later. I just finished a view that load image and save it to cache memory. – Sergey Shustikov Jul 07 '15 at 19:23
  • @EdsonMenegatti thank you, the picasso library looks definitly like a solution to a part of my problem! – Simon Jul 07 '15 at 19:27
  • @ssh thank you, i would really appreciate that! – Simon Jul 07 '15 at 19:28

4 Answers4

1

Take a look at the Glide or Picasso libraries. Those are super easy to use for thread-safe downloading of images.

Personally, I just fetch/store the images on imgur.

If you want to upload a dedicated databse, you'll have to set one up. Some common ones are Amazon, Google, etc. There are tons.

adao7000
  • 3,632
  • 2
  • 28
  • 37
1

Have a look at this answer. In this answer Picasso library is used to handle image download. Picasso gets rid of a lot of coding and testing to handle image download.

In a project that I am working on, we use Amazon S3 to store our pictures, it's very reliable and is one of the goto solutions right now.

From what I heard Snapchat and some other big firms use S3 to store their picture! It's also very cheap, plus I believe they have free hosting to a certain degree.

This is their API guide for android.

We use a service called File Picker to handle upload and download from amazonS3, it reduces a lot of work, but I don't think it's a free service.

Community
  • 1
  • 1
rgv
  • 1,186
  • 1
  • 17
  • 39
  • 1
    thank you for your input, the links seems to contain a lot of useful information for my problem! – Simon Jul 07 '15 at 19:30
0

You can use Picasso for downloading images from network in Android. For storing images Amazon S3 or Google cloud storage can be your options.

Akhil
  • 6,667
  • 4
  • 31
  • 61
  • thank you for your help. Do you also know an option for storing images online which is for free? (if there is one...) – Simon Jul 07 '15 at 19:33
0

Not sure if downloading packages is better than downloading individual pictures (archiving won't save you much space).

As for your question, you can make some kind of API you will query from your app, even a flat file hosted somewhere with changing content would work. Your app could check it periodically for the new address to download pictures from (assuming it will change).

another way is using push messages - sending out a push through GCM that your apps will receive that will notify them about new content available. It would even work when the app is closed.

Malthan
  • 7,005
  • 3
  • 20
  • 22
  • thank you for the answer! could you be more specific on how it works to make such kind of API and where to host this flat file? GCM sounds interesting, that is definitely an option – Simon Jul 07 '15 at 19:39
  • Well you would need to get a server to host it on, depending on the amount of traffic you generate you could perhaps find a free one. Putting a lets say json file on a server shouldn't be too expensive. Alternatively you could write a regular API in a language you are proficient with, but it's probably overkill for such a simple case. – Malthan Jul 07 '15 at 20:04