Android adding files on install - android

Is there any way to add files in Android storage on install? Like some image/video that will be stored there on install and if needed it would be loaded, like pushing a button or something like that ?

Is there any way to add files in Android storage on install?
Not really. You are welcome to package files as assets, then copy them to internal storage on first run of your app. Or, depending on what sort of file it is and what you want to do with it, you might be able to just use the original copy of the file as an asset directly.

Related

Downloadable files in my application

I created a project which uses Fragments, and in one of them I want to add some clickable icons that will allow to download a file (one per icon).
I have the files stored on my computer.
I suppose that they have to be copied into my application.
How I can implement this in the code?
I hope that this picture can explain what I want to do.
will allow to download a file and they have to be copied into my application don't match: If the files are already on the device (once your app is installed), what is the sense of downloading those files again?
Therefore, either provide your files inside your app or use a file server and download them.
If you decide to provide the files in your app, this will increase the installation time.
But it would not require an internet connection to download the files again.
So, simply put your files in the raw or in the assets folder and that's all.
Then simply access your files from that folder.
If the folder isn't already found in your project, simply create it and drop your files in it.

Where to put files for External Storage Android

So I have some files I want my Android App to access, read and write.
I want to store it internally. Where can I put these files in my Java Project so they are accessible or can this not be done?
There are three ways to achieve this, and according to your requirements select the approch
on SDCARD
This is the normal SDCARD/in-build SDCARD in newer smart phones. you need to create specific folder structure and put your files there, here you can do file read and write both
but this in insecure because accessible to all the application
on Internal Storage
This is given as Applicaiton specific storage where you can create the file and do the operation, this is most secure way to do it, but this is generated run time so you can not push the files directly, you can put your files in RAW or ASSETS and copy that here
RAW and ASSETS
This is in the code structure only and only read access is given to this folder, you can not change this file run time.
if you select any one of this approach then simple goggling will show you the sample code.
You can read or write files in the path of your internal storage as
data/data/package_name/files . I had already answered a similar question you can check it out.

Add some files to my android app folder

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.

Pushing gestures Data programatically onto the raw folder

I want to push the data stored in the gestureslibrary onto my raw folder in the project.I want to do this in my program via code and not manually.How do i do this?
An application's apk file and the folders it contains are not writable by the application. You will have to store the information in private storage or external storage.
If you mean you want to automatically include something when building the application, look into extending your build system (IDE or ant) with a custom script.

Best way to do a separate data install on Android

I want to decouple data from code on my Android application, and I am not sure of the best way to do that.
For instance - with the Linux Mahjongg game you can add new tiles to the game by dropping a specially formatted file into a specific directory. The Mahjongg game checks that directory when it starts up.
I want to do the same thing with my Android app - I want to be able to install the app, and then have separate installs for different data files. It's the data file installs that have me hung up. I do not want to have to set up my own server and write my own download code.
You can ship the data with the installer app, then use Input/Output Streams to copy the data from the assets or raw dirs.
Check this out:
Ship an application with a database
The answer has an implementation of in/outputstream. You don't need to use a db, just copy the file to ext storage.
One important detail: if you put the file in assets, it will be shipped compressed, and the phone/tab will try to uncompress the file in its entirety in memory. One (hocky) way to avoid that is to name the file .mp3. Assets in .mp3 format are not compressed. (Hey! I said it was hocky!)
The installer app can either uninstall itself by using ACTION_DELETE in an intent (see http://android.amberfog.com/?p=98 for details) or just show a msg to the user that it's safe to delete the data app.
HTH,
llappall
by dropping a specially formatted file into a specific directory
You can do that on external storage. Create a directory, and check it when your app starts up for new files. Tell the user they have to stick the magic files in the magic directory for it to work.

Categories

Resources