c# - UWP - 应用内产品 - GetAppLicenseAsync() 的速度

标签 c# uwp windows-store-apps in-app-purchase windows-store

我正在迁移

  • Windows 8.1 应用,它使用 Windows.ApplicationModel.Store 命名空间用于 IAP
  • 带有 Windows.Services.Store 命名空间的 Windows 10 UWP

为了确定应用内项目的许可状态,前者有一个 LicenseInformation 属性,而后者有一个 GetAppLicenseAsync() 方法。

因此,对于前者,有关 IAP 的信息(似乎是?)是即时的,而对于新方法,信息可能需要更长的时间。

我的问题:新概念真的更慢还是速度相同,新的异步方法只是反射(reflect)了获取信息从来都不是瞬时的事实?

我的应用需要在应用启动时就已购买的所有商品的信息。因此,我看到的唯一方法是在应用程序启动时调用 GetAppLicenseAsync() 并等待信息出现,然后再显示用户界面。

编辑 2017-07-25:

简而言之,我的问题是:GetAppLicenseAsync() 方法最多需要多长时间?

最佳答案

Is the newer concept really slower or is the speed the same and the new async method just reflects the fact that getting the information has never been instantaneous?

当您调用 GetAppLicenseAsync() 方法时,需要多长时间才能看到用户界面?

对我来说,新命名空间中的 API 是即时的。也许您的请求延迟可能与您的网络环境有关。但是,LicenseInfomation 的结果存储在本地,因此它可以是即时的,因为您可以离线获取信息。对于新命名空间,您还可以在用户首次购买该商品时将应用许可信息存储在本地存储中,这样您的应用启动过程就不会受到网络环境的影响。

此外,根据this document中的注释:

If your app targets Windows 10, version 1607, or later, we recommend that you use members of the Windows.Services.Store namespace instead of the Windows.ApplicationModel.Store namespace. The Windows.Services.Store namespace supports the latest add-on types, such as Store-managed consumable add-ons, and is designed to be compatible with future types of products and features supported by Windows Dev Center and the Store. The Windows.Services.Store namespace is also designed to have better performance.

因此,将命名空间迁移到 Windows.Services.Store 是合适的。

关于c# - UWP - 应用内产品 - GetAppLicenseAsync() 的速度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45245274/

相关文章:

c# - 通过代码添加应用栏(Windows 8.1,C#)

javascript - 如何单击没有 onclick 事件的表单提交输入,但在页面中单击时会发生某些情况如何单击它?在 C# 中?

C# 无法让 RegEx 适用于所有情况

c# - UWP 应用构建失败 "Microsoft.UI.Xaml.Markup could not be found"

javascript - C#从客户端应用程序中的WebView控件调用托管应用程序中编写的JavaScript函数

c# - 更新按钮查询无法正常工作 mysql c#

c# - 获取当前的笔记本电脑盖子状态

c# - 在 VS2010 中更改 "{"的默认位置?

visual-studio - 构建 UWP 项目的发布版本导致错误

c# - 我们如何检测 WIndows 8 中的系统音量?