How to download a file which is not readable in android? - java

For school, I'm working on an android app which is supposed to deal with some files. I've done the code app by putting files into the assets folder.
Now the problem is that the files need to be updated by getting replaced by the file from an URL of this shape : "http://ade6-ujf-ro.grenet.fr/jsp/custom/modules/plannings/anonymous_cal.jsp?resources=1120&projectId=2&calType=ical&firstDate=2018-03-30&lastDate=2018-03-30".
I've tried a lot of download functions that I found here but they are all dealing with text files which they get from the URL and write, line per line, them down to the internal/external storage.
So my question is, how can I download the file to an "app folder" on the internal storage.
Thank you so much for your future help !

Convert your file to String.And encrypt it with your password.
How to convert a File object to a String object in java?
https://stackoverflow.com/a/12559960/6533179

Related

How to read binary files like .efi files in Android Studio?

I want to read data from a file with .efi extension and transfer that data from Android.
I tried copy pasting the content but missing (nul) and some other characters. Could someone help me to read efi file in Android Studio??

How to read txt file from Google Drive?

I'm trying to make launcher for my game. I want it to display update log. How I want it to work:
Replace log.txt file on Google Drive and new log will be displayed in launcher.
I have no idea how to make this. Also I have to make auto-updater.
It will work similiar to update log - upload .jar file and res folder on drive. When game launched it will check for updates and if new update available it will download it.
Like I said, I have no idea how to do this.
I advise you to use GitHub to upload your files. Then you can use the URL provided by GitHub to open a urlStream in your project and read that file like a .txt.
Google drive is a file explorer only. It will allow you to upload and download files, it does not have the power to display or edit them. Unless you want to display them in the Google drive web application in which case there should be a webContentLink available in the response data for the file.get method, however the file will need to be either public or the user must have access to it in order to be able to see it.
To display the file you will need to download it and display it locally. To edit it you will need to download the file and edit it then upload it again.
Tbh i think what you are asking is out of scope for this api.

How to append data to existing Dropbox file?

I'm accessing Dropbox API to upload and download files using Java. Now, I need to create a function which can append data to existing Dropbox file.
I've a working code which first downloads a file and then uploads it with the text appended. However, is there is a better way to do this, because my code has is inefficient?
Thanks in advance. :)
Conventionally there is no support for direct file editing in Dropbox, so what you looking for is not supported in existing APIs of Dropbox, possibly what you are doing currently,
first downloads a file and then uploads it with the text appended
is the best (and the only) way of modifying files in Dropbox cloud.
But apart from this it does support file revision mechanism, which can be achieved with help of /delta, /revision
A way of letting you keep up with changes to files and folders in a
user's Dropbox. You can periodically call /delta to get a list of
"delta entries", which are instructions on how to update your local
state to match the server's state.
https://www.dropbox.com/developers-v1/core/docs#revisions
Best Luck :)

Prevent Google Photos to ask for backing up app folders

I am making a chat app that stores sent images in it's private folder on external storage. After saving an image the Google Photos app notices that and asks if the user wants to backup that folder.
Is there a way to prevent that?
'.nomedia' file does not help.
Kindof, Google backup reads imgs and video types.
There are 3 workarounds that I know,
Make the Folder hidden.
Add "." before the folder name. (when u create the folder)
Have a lot of folder hierarchy.
Example: /0/AppName/sentimgs/ <- Can be read by google backup
/0/AppName/bla/bla/bla/sentimgs/ <- Cant be read.
Save the img without an extension. And make ur app add it when they want to view it.
The Shank's first solution worked for me.
However, I noticed that I created .nomedia file wrong, so after fixing it the backup problem has been also solved.

How to create my own custom file type containing an image or an audio file

I want to find a way to save captured picture and recorded sound in custom file-type(s) then open them in my app. I don't want to other apps could open my files (for example gallery app don't open my pictures).
Is there any way to encode and decode my files in my app for example by writing a string at end of files.
Thanks
There is no need for custom file types. If you save your files in Internal Storage, no other application can access them. You can also save files in the External Storage that are private, by calling getExternalFilesDir().
Details are here: http://developer.android.com/guide/topics/data/data-storage.html#filesInternal
Use a file extension no one else uses, then use this answer to open all such files with your app.

Categories