I am using DownloadManager to download files. I am getting 492 status when download fails. However I can download the same file from any browser. The error is frequently coming for some files. After searching about the status I got that this error comes when the device does not have enough memory to store download file, but on my device I left with 2 GB of storage. Can some one please help me to work around this problem.
Hi think I found the solution. The downloading was getting failed because of special character in title. I removed the special character and then download was working fine.
Another possible source of the problem, which I think is more general, is that destination folder is not exists (and DownloadManager not always creating it for you - it is platform dependent for some reason).
Related
I'm building my first Android app and have run into a little problem. Using AsyncHttpClient to download Pdf files I get
"E/dalvikvm-heap(30871): Out of memory on a 21893326-byte allocation."
errors on anything larger than 15 Mb. Files up to 15 Mb download just fine. Are there any settings that can resolve this?
Thanks in advance for your help!
Are there any settings that can resolve this?
Not really. Assuming that you are using BinaryHttpResponseHandler, it will give you the entire file in memory, which will not be possible for larger files.
You would need to create your own version of BinaryHttpResponseHandler with a modified sendResponseMessage() method, one that streams the results directly to a file. Or, find another HTTP client library that does this for you.
I am trying to transfer files from my android emulator to my server. I observed that files of size around 2MB or greater are just not getting transferred.
Is it because of the internal memory I've provided to the emulator. If it is, should I change the way I'm transferring the file? My transfer method is similar to the only here: Android:How to upload .mp3 file to http server?
Yes, I found the answer. I had to make a change in the PHP ini file and increase the limit to my desired size :)
So there is nothing wrong with the emulator as such, it was a problem at my webserver end.
I updated my ADT to r20. It becomes very slow to open the docs when I have internet connection. But it works well in offline mode.
It is very slow to open xxx.html in the docs directory by clicking them directly.
why? And how to fix it?
I found the problem. The url is something wrong when the html file accesses internet to download some resource files. I get these information when I access the docs' html file.
GET file://fonts.googleapis.com/css?family=Roboto:regular,medium,thin,italic,mediumitalic,bold
GET file://www.google.com/jsapi/
The two are to download js files from internet, but fail to get them due to the wrong url.
How to prevent the two url accessing the internet? There are so many html files in docs, it is impossible to edit them all.
Help!
I am not a new developer to android. I have an application on the market. However, sometimes I get reported strange exceptions to have occured:
java.io.FileNotFoundException: res/drawable-mdpi/background.png
android.content.res.Resources$NotFoundException: File res/drawable-mdpi/background.png from drawable resource ID #0x7f02001f
This is by all means untrue because otherwise I wouldn;t have compiled or run the program myself. Also I am sure the resources are there. This is just one of the exception I have been reported. There are same exceptions for other resources mainly layouts.
So my question is how would this happen? Is it because the android system has failed installing correctly my app? I almost sure this must be the case because I have many users who use it without problem.
Please help regarding this.
There can be several possible reasons:
Moving application to SD card.
There was some problem in downloading or installing APK from market (file can be corrupted).
User get APK with corrupted file from other source (for example via bluetooth from other user)
Some system bug (from software, to brocken hardware)
Any way You can't do anything with this problem.
Could it be that the application was pushed to SD Card and something happens to the drawable while on SD. I saw similar issues with layouts rather drawable and it was because the application was pushed to SD.
Maybe you have included certain codes that reference content from Android SDK.
In my case, I faced similar issue and when I removed the line
android:background="?android:attr/actionBarItemBackground"
from my xml, everything works fine again.
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