0

I'd like to know if there is any way to update a specific file in the package (apk) that was originally shipped?

In my case I need to make sure that a certain text file comes with the app when downloading the apk. However, I want to be able to update that text file remotely and replace only that text file, not the entire apk-file.

you can write and create files that are in the so called "internal storage", but how do I place the text file there in the first place; that is, how do I make sure that the text file is in the "internal storage" so I can read it with openFileInput(...) after the install of the apk?

Because if I can place the text file in "internal storage" so it can be reached by openFileInput, I can easily overwrite it later, but then it has to be there in the first place =).

halfer
  • 19,824
  • 17
  • 99
  • 186
Ted
  • 19,727
  • 35
  • 96
  • 154
  • So far, I can copy the file placed in "assets" to "internalStorage" and then update the file in internal storage by using openFileInput/Output... That is one way, the problem then comes if I use debug; the "internal storage file" is still there, and the updated file in assets is not used... – Ted Oct 18 '11 at 17:08

1 Answers1

0

If you want to be able to update the text doc without updating the entire apk each time you updated the text doc, then you will need to host the text doc on a website and have the apk fetch the document. You could create an alarm to fire off and then have a broadcast reciever retrieve the document and store it to the app. Or you could have the text doc on a website(google site is free) and have the app read from it, and store the data in a SharedPreference.

If you need code on how to read from a text doc let me know. As i use this process for one of my apps. It works perfect.

coder_For_Life22
  • 26,645
  • 20
  • 86
  • 118
  • Hi, I do understand how do download files from the net. The question is really how I place a file ("static"), so that the file is shipped with the apk *and* available in the "internal storage" so that I can overwrite the file later on. – Ted Oct 17 '11 at 14:18