I want to add some HTML files in my program that can be update later.
I want to add these files in assets folder but I can't rewrite files when downloaded.(eclipse)
The assets folder is inside of you package - obviously you can't edit that.
Download such updates to your applications data directory. You'd then have to check in code if there is a file in the data directory, and if not use the one in assets.
Related
In my flutter project, I want to download some files from a url and save particularly in a folder named data. I have added Read and Write permission in AndroidManifest.xml file. I have also tried some solutions like the below link-
flutter - How to download asset when apps launched and used it
But none of them was effective for me. some of the solutions let me save the file in SD card but I only need to save the file in my data folder and read data from the file whenever I need.
Here's the picture where I exactly want to save my file-
So, I need a proper solution to download the file from the url and save it to this particular directory.
https://pub.dev/packages/download_assets if you don't want to add assets at time of build try this package it download asset from server and store it in assets
I have a question, I want to ask about reading data from files to construct setting for application.I want to download new files from the server to replace the files in the asset folder, but the files in asset folder doesnt allowed me to replace them, So I want to know is there any other way to do this ?
The assets folder in Android, are readonly, you can't add or edit files. So, if you want to use internal data files and replace them with a download, you have to set another directory, such as Internal Storage or External Storage.
In assets folder in my Android project, i have .dat and .xml files. They must be updated periodically. I don't want to update them by myself, there is a web service that i will store new .dat and .xml files as .json objects. How may i make the application update assets folder by itself?
Thanks.
As Siddharth Lele mentions in the comments, you cannot update assets/ at runtime, except by upgrading the app to one that contains a newer assets/.
You can, however, download your .dat and .xml files to internal storage. Then, when you need to use one of these files, check internal storage first. If there is a file there, use it. If not, fall back to the copy in assets/.
I am planning my android app with some files in the app folder, but i didn't figure out how to add files to my project. I don't want to use the files as resources because the user should be able to save or download more files in the same folder and i just wanted to add the basic set of files.
Can anyone help me? :/
I don't want to use the files as resources because the user should be able to save or download more files in the same folder and i just wanted to add the basic set of files.
There is no direct means of doing this. If you package your files as assets (in assets/) or as raw resources, you are welcome to copy them out of your APK into internal storage on first run of your app.
I want to update the content of a file on my res/raw folder called dbschema.xml, using a newer version of dbschema.xml that is somewhere on the phone (for exemple, at data/data//dbschema.xml)
I've already done the part to check if the new file exists, and i want now to copy it to raw.
Do you have any idea?
Thanks.
It's not possible, you can't modify the content of those files since they are inside the installation package. You could instead copy the file to the private directory of your app, read it from there and update when needed.