更新 apk 附带的特定文件?

发布于 2024-12-10 14:56:51 字数 310 浏览 0 评论 0原文

我想知道是否有任何方法可以更新最初发布的包(apk)中的特定文件?

就我而言,我需要确保下载 apk 时应用程序附带某个文本文件。但是,我希望能够远程更新该文本文件并仅替换该文本文件,而不是整个 apk 文件。

您可以编写和创建所谓的“内部存储”中的文件,但如何首先将文本文件放置在那里;也就是说,如何确保文本文件位于“内部存储”中,以便在安装 apk 后可以使用 openFileInput(...) 读取它?

因为如果我可以将文本文件放在“内部存储”中,以便可以通过 openFileInput 访问它,那么我以后可以轻松地覆盖它,但它必须首先存在=)。

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 =).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蒗幽 2024-12-17 14:56:51

如果您希望能够更新文本文档,而无需在每次更新文本文档时更新整个 apk,那么您需要将文本文档托管在网站上,并让 apk 获取文档。您可以创建一个警报来触发,然后让广播接收器检索文档并将其存储到应用程序中。或者您可以将文本文档放在网站上(谷歌网站是免费的)并让应用程序从中读取数据,并将数据存储在 SharedPreference 中。

如果您需要有关如何从文本文档中读取内容的代码,请告诉我。当我将这个过程用于我的一个应用程序时。它工作完美。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文