Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the differnce between accessing file from assets folder or SD card

I am developing an application where I have to use three different size's file (1mb, 5mb, 15mb). I searched, then came to know that we can keep these video in assets folder and can use those video.

Secondly, I came to know that we can keep these videos in assets folder and installation time we can move all videos to SD card. when tried second approach faced problem due to bigger file size.

So, can anyone please tell me what is difference between both approaches and which one I should use. Any pointer will be appreciated.

like image 220
CodingRat Avatar asked Jan 10 '13 12:01

CodingRat


People also ask

What is the purpose of the assets folder?

The Assets folder is where you should save or copy files that you want to use in your project. The contents of the Project Window in Unity shows the items in your Assets folder.

What are assets folder?

Assets provide a way to add arbitrary files like text, XML, HTML, fonts, music, and video in the application. If one tries to add these files as “resources“, Android will treat them into its resource system and you will be unable to get the raw data.

How do I add files to assets folder?

Now, Right-click on the Assets folder and click on the File option by hovering over the New option. Enter the name of the file name and click Enter to create the file.


1 Answers

Files over 1mb placed in the assets folder won't be readable from your app (It'll throw an exception).

This is because they get compressed during the build process, and thus the phone requires substantial resources to uncompress them when on the handset.

If the asset is compressed, the system has to uncompress the entire thing to memory. If you have a 20MB asset, that means 20MB of physical memory is tied up by your application.

I believe you can place them in the raw folder, where they won't get compressed.

EDIT :

You can upload upto 50MB file sized APK to android market, that is standard and it is now giving support to bigger sized APK's too. See below reference link for this:

Android Apps Break the 50MB Barrier

Thanks.

like image 130
Pratik Sharma Avatar answered Oct 12 '22 14:10

Pratik Sharma