0

I am developing an app and I want the photos used in this app to be packed with the apk. The problem is that these photos are downloaded first time when I create the database. In the database I store only location (for example City: Name | Population | Photo Location). Everything works fine but the big problem is that I don't want these downloads to be made at install (it takes 10 minutes because there are a lot of photos), I want to have these photos available at install and be packed with the apk (like the database from assets).

I saw this: Saving and Reading Bitmaps/Images from Internal memory in Android

And currently my photos have been downloaded and are in the /data/user/MY_PACKAGE/imageDir. I don't have any permissions to copy the photos from this folder and if I uninstall the app the photos will be deleted too. And this is not good, I will download the photos with Java and place them manually somewhere, but I don't know where.

My question is where should the photos be placed to have access to them when using the app? And how can I make them download in that folder, without the need of moving the manually?

Community
  • 1
  • 1
green
  • 153
  • 3
  • 13
  • 2
    So why don't you provide the images as application resources? – Phantômaxx Jun 03 '16 at 09:26
  • 2
    Can't you just put them in a folder, such as app/src/main/assets? They'll be shipped with the app, and you'll be able to get their path when creating the database with `String path = "file:///android_asset/";` – NSimon Jun 03 '16 at 09:28
  • Yes I can do that but I have to do it manually because assets is READ ONLY and I cannot download them via http get and put the programatically into assets – green Jun 03 '16 at 09:29
  • 1
    We are suggesting you NOT to download them. But to provide them yourself. –  Jun 03 '16 at 09:30
  • What you mean to provide them myself? They are downloaded via Http get because there is a very large number of photos – green Jun 03 '16 at 09:33
  • 1
    *You* download them *first*. Then ship your app with *all* the images *already included*. And so your users won't have to download them. –  Jun 03 '16 at 09:35
  • Ok so there is not way to do this without manually intervention? – green Jun 03 '16 at 09:40
  • 1
    Unclear... If you provide the images, the users won't be bored to hell by downloading the images. Easy. –  Jun 03 '16 at 09:46
  • 2
    So I was thinking there is a way to download them and put them directly into the resources folder/assets (just the first time) but I know that folder cannot be written and I was wondering if I can create a folder like assets or resources in the project structure or anywhere and then just get my photos from there (this code running only to download them and after that this folder to be added to my project. But I will put the myself in the resources folder and that's it – green Jun 03 '16 at 09:56

0 Answers0