如何区分应用是更新还是首次安装?

发布于 2024-11-07 15:48:31 字数 230 浏览 0 评论 0原文

让我澄清一下我的意思。我已经在市场上发布了 1.0 版本的应用程序。现在我想将我的应用程序更新到版本 1.1。我编写了一个方法,仅当应用程序从 1.0 更新到 1.1 时才应调用该方法。当新用户已经从市场安装 1.1 版本的应用程序时,不应调用该方法。

有什么建议吗?

编辑

我可以通过获取应用程序安装日期来解决我的问题。有什么方法可以通过代码获取此类信息吗?

Let me clear what I mean. I’ve published on marketplace the app in version 1.0. Now I want to update my app to version 1.1. I wrote a method which should be called only when the app is updated from 1.0 to 1.1. When new users will already install the app in version 1.1 from marketplace a method should not be called.

Any suggestion?

EDIT:

I could solve my problem by getting date of app installation. Is there any way to obtain that kind of information in code?

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

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

发布评论

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

评论(1

放肆 2024-11-14 15:48:31

你必须自己处理这个问题。

最简单的方法是存储(在isolatedStorageSettings中)当前的应用程序版本号。然后,您在启动时检查此项并将其与当前应用程序版本号进行比较。

如果设置中没有值,那么您就知道这是第一次安装。
如果版本号不同,您就知道应用程序已更新,并且您可以在升级过程中采取任何适当的操作。 (旁白 - 我一直认为应用程序承认它们已升级是件好事。)

无法获取安装的日期时间,但您可以捕获首次运行的日期/时间。只需在存储版本号时获取(并保存?)日期/时间。请注意,您的设备上的日期/时间可能会发生变化。如果您想使用网络服务来获取日期/时间,那么您将不得不处理无连接的问题。
我建议不要尝试纯粹根据设备上的日期/时间来确定版本/升级,因为有许多可能的问题需要考虑和解决。

You'll have to manage this yourself.

The simplest way to do this is to store (in IsolatedStorageSettings) the current app version number. You then check this when you start and compare it with the current apps version numebr.

If there isn't a value in settings then you know it's the first install.
If the version numbers are different you know the app was updated and you can take whatever action is appropriate as part of the upgrade. (Aside - I always think it's nice when apps acknowledge that they were upgraded.)

There's no way to get the datetime of installation but you could capture the date/time of first run. Just get (and save?) the date/time when storing the version number. Beware that you will be subject to changes in date/time on the device. If you want to use a webservice to get the date/time then you'll have to deal with issues of no connectivity.
I would recommend against trying to determine the version/upgrade based purely on the date/time on the device as there are many possible issues to consider and work around.

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