0

I am creating a social app for android and am planning ahead, what would be a viable way in Android to store potentially millions of user generated uploaded photos. I have a MySQL database that saves the image path and was thinking of creating a folder outside of the /drawable directory to save the physical images. I could do that but then I thought that if I did then the Android APK file would just balloon in size since your storing all the images within the app; is there a better way to store many images? I been searching around for answers but there aren't many on this topic for android.

user1591668
  • 2,591
  • 5
  • 41
  • 84

2 Answers2

0

What most of the Social media apps do is that they SYNC the data. Thats what you need to do. Don't add images in the application .Rather get the External Storage location/ path in the phone .Refer this Question and this Question and this link. And then when the user open's the application. Sync the data w.r.t to your MySql database vs Sqlite local database.

This way you will also be able to avoid OutofMemory Bug

Community
  • 1
  • 1
Quamber Ali
  • 2,170
  • 25
  • 46
0

What you want is not to save the images in your apk but in external folder. Once you app has been turned into apk you cannot modify anything in it.

The thing about Android devices is that they come in great deal of varieties. Some have SD Card slot, some only have internal storage (like Nexus) and cheaper models don't have plenty of memory.

Dynamic content like what you have should be accessed via remote server and only on-demand basis. If your user no longer sees or doesn't want to see it then don't keep it on his phone. And people who are active in social media are not interested in stuff that happened days ago. My suggestion is: store your images in AWS S3 or other cloud solution, then make the app communicate to your server to retrieve the urls. Images which are actually downloaded to a device should be cached with expiration, maybe a few days. Leave as small footprint as possible.

inmyth
  • 8,880
  • 4
  • 47
  • 52