与我的 android 项目一起分发一个文件,该项目将来会更新

发布于 2024-11-24 23:28:56 字数 362 浏览 3 评论 0原文

我正在创建一个简单的 Android 应用程序,它将是一张标记有许多点的地图。这些点有时会根据互联网上托管的 XML 文件而改变。

为了减少初始加载时间,我的目的是将这些点的序列化列表与可以在将来更新的应用程序一起分发。

起初我的意图是将这个序列化文件作为“资产”分发。这样我就可以生成文件并将其放入“资产”中。但是,这不起作用,因为(据我所知)我不可能覆盖这些资产。

第二个选项是使用内部存储,但是(据我所知)我无法将此文件作为“内部存储”分发。

我是否可以选择将序列化列表作为资产分发,然后在初始加载时将其复制到内部存储?这些文件只有 50kb 左右,但似乎没有必要将同一文件的 2 个副本(其中 1 个最终会过时)作为同一应用程序的一部分。

I'm creating a simple Android App, it will be a map with a number of points marked on it. These points will sometimes change, based on an XML file hosted on the internet.

To reduce the initial load time my intention is to distribute a serialized List of these points with the application that can be updated in the future.

At first my intention was to distribute this serialized file as an 'asset'. This way I could just generate the file and drop it in to 'assets'. However, this does not work because (from what I can see) it is not possible for me to overwrite these assets.

The second option was to use the internal storage, however (from what I can see) I can't distribute this file as 'internal storage'.

Is my only option to distribute my serialized List as an asset and then on the initial load copy it to the internal storage? The files only going to be around 50kb but it seems unnecessary to have 2 copies of the same file (1 of which will eventually become outdated) as part of the same application.

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

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

发布评论

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

评论(1

明明#如月 2024-12-01 23:28:57

总是首先检查内部存储,如果您的数据不存在,则读取“资产”版本怎么样。

然后,您将有一个同步作业,它将下载更新的文件(当可用/更新时)并将其放入内部存储中。但是,是的,我想你会一直坚持保留原始文件。

How about always first checking the internal storage and if your data does not exist there read the 'asset' version.

Then you will have a syncronization job that will download the updated file (when available/updated) and put it in internal storage. But yes I guess you will be stuck with always having the original file there.

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