I am writing an android application which has a lot of images in it.
I do not want to keep these images as a part of my apk file because that will make the size of the apk file very huge.
I have written the application in a way that it loads these images at runtime from the sdcard from some predefined location. Now my problem is that how do i provide these images to the user who wants to install my application. Since the images are not a part of the project (i.e. not present in any of the drawable folders) so they will not be a part of the APK file that i provide.
Is it even possible to do such a thing in Android? Or can someone suggest a better solution that i have right now. Any help is greatly appreciated.
There is an official way to achieve what you want: APK Expansion Files
Related
I've 100's of .gif images to be used in a android application that I'm trying to build. Can any one suggest me how should I minimize their size. And should I place them in drawable directory.
Google play has a limit on APK size which can be uploaded to playstore(if I am not wrong its 100Mb), so having so many .gif files inside application drawable folder will not be a solution.
Best solution I could think of right now is via Dynamic asset delivery by google play.
Please go through below for more info on asset delivery
https://developer.android.com/guide/app-bundle/asset-delivery
Greetings dear readers,
I have this query which the team is facing. We are developing a hybrid app for android platform and ran into one issue that seems to get complicated.
Here it goes.
Team is calling static HTML pages(no control on html content modification) in a web view, the html page content involves images which are taken from asset folder. Now when we are debugging the application on android device, asset folder images are getting copied automatically in gallery.
I am not a native coder but it seems asset folder images will be copied automatically. Please correct me if I am wrong. Is there any way, When I debug my app on device I could restrict this automatically copying of asset images to device gallery.
As I am not from Android, this might be the silly question but any help in this scenario would be highly appreciated.
I have researched on google to find out possible fix but unable to find one.
Guys, please suggest.....Any leads on this....
If you don't want your photos being accessible from gallery, add .nomedia file to the folder copied onto the device. This will prevent photos from appearing into gallery.
I try to make Webview from to display application/x-shockwave-flash embed element in my app, but i have blank gray screen on emulator and white on device. There are many topics about this problem but any1 really solved.
I explore log of simillar app and see: file//android_asset/index.html. So question... this static file or i can get it from web or modify it.
I trying get my data video.loadDataWithBaseURL() from web, but can i have that data from local storage?
Maybe I said something wron but it's look for me like 'convert web data to local'?? Can some one help my in my problem or explain in this question.
Thank you.
file://android_asset/ is a way that allows android apps access assets by a network-based URI. But assets represent neither local nor online files, they are packed into your apk. Put any files in assets folder in a android project and they will be packed into the apk file by the builder.
The app images (png) in the drawable folder can easily be extracted with a zip tool.
Was thinking that an APK file would be more "closed".
Is this normal?
Is there some way to fix this?
Is this normal?
Absolutely.
Is there some way to fix this?
No, because there is nothing to "fix". Anybody capable of getting at your APK file is also capable of getting at your images wherever else they might be stored (e.g., downloaded from the Internet and cached in on-board flash). And anybody using normal SDK tools can take screenshots of your app and get at your images that way. Protecting images is a pointless exercise.
An APK is really nothing more than a compressed archive. It is completely normal for the PNGs to be accessible from the unzipped APK. Its going to be nearly impossible to prevent a resourceful hacker from getting your images if they want to. You can do things to prevent it but it is going to be more of a headache then its worth.
If you really want to keep the drawables out of the APK you could simply download the drawables from a website the first time your applications loads. This however has other problems because you would then have to prevent unauthorized downloads of the drawables.
I have 11 videos to include in my App. Each of them is around 9MB. Besides those, I have to a few sound files and image files in the app. Therefore the app size is going 100+MB. Is there any way to accommodate all the files so that app size does not become an issue for me?
Download the files after starting the app for the first time.
Puh..that's quite large. In such a situation I'd
Let the user download your app not containing any videos/audio files that cause the large size
At first run guide the user through a wizard where you download the additionally needed files to the SD card.
Still, downloading nearly 100MB won't be ideal, but better than directly download all of it at the first install. (IMHO)
The most common sollution i've seen is downloading them during the first run of the programme. Just check if everything is available, and if it isn't, download the needed files.
pros:
This way you can also add video's on the fly.
APK size stays small so initial download is quick
Cons:
after downloading the app you can't directly use it: content must be downloaded first
I would suggest you to put them in the assets folder, so they will not be compressed.
This way you'll have problems testing your project with eclipse, so try building it with command line, and then install on device with adb
In my scenario, I had 300+ videos, totalling upto 400+ MB of the size.
I checked with few of them and deployed the app the way i just told.
may not be the best way around, but may work.
You can upload into youtube or make your own simple video streaming server