如何查看应用程序的首次安装日期?
How to check the first date an app is installed?
我有一个付费应用程序,想在商店中免费提供几天。但只针对那些在这些特殊日子里安装它的人,我想展示广告。
如何检查用户是否在特定时间范围内安装了该应用程序?
我想到了这些解决方案:
- 我可以在以前的包裹中签到并在此检查
包裹。如果它不可用,这是第一次安装。
- 第一次安装后可以保存日期
但是现在这些都行不通了。
谢谢。
您可以 get App receipt from the store (here is 它的外观)并解析您产品的 PurchaseDate。但是,这将 return 首次安装该应用程序的日期,如果用户重新安装了该应用程序,则它将 return 首次安装的日期(第一个 'purchase' 从商店)。
您还可以在 LocalSettings 中设置一个值,该值将负责记住应用程序首次 运行 的日期。但这并不意味着安装日期 - 用户可以安装应用程序并 运行 一个月后。此外,当用户重新安装应用程序时,您将获得新值。
您可以使用 Windows 集合 API 将您的查询范围限定到您的特定产品(应用程序或附加组件)。发送请求后,您将收到一个响应,其中包含一个数组项 CollectionItemContractV6
,其中包含 acquireDate
等您可能会使用的参数。然后您可以为在正确时间范围内安装您应用的用户解锁该功能。
您可以按照以下步骤使用此 API:
- Configure a Web application in Azure AD.
- Associate your Azure AD client ID with your application in the
Windows Dev Center dashboard.
- In your service, create Azure AD access tokens that represent your
publisher identity.
- In client-side code in your Windows app, create a Windows Store ID
key that represents the identity of the current user, and pass the
Windows Store ID key back to your service.
- After you have the required Azure AD access token and Windows Store
ID key, call the Windows Store collection API or purchase API from
your service.
有关更多详细信息,您可以查看 Query for products,其中包括请求和响应示例。
我有一个付费应用程序,想在商店中免费提供几天。但只针对那些在这些特殊日子里安装它的人,我想展示广告。
如何检查用户是否在特定时间范围内安装了该应用程序?
我想到了这些解决方案:
- 我可以在以前的包裹中签到并在此检查 包裹。如果它不可用,这是第一次安装。
- 第一次安装后可以保存日期
但是现在这些都行不通了。
谢谢。
您可以 get App receipt from the store (here is 它的外观)并解析您产品的 PurchaseDate。但是,这将 return 首次安装该应用程序的日期,如果用户重新安装了该应用程序,则它将 return 首次安装的日期(第一个 'purchase' 从商店)。
您还可以在 LocalSettings 中设置一个值,该值将负责记住应用程序首次 运行 的日期。但这并不意味着安装日期 - 用户可以安装应用程序并 运行 一个月后。此外,当用户重新安装应用程序时,您将获得新值。
您可以使用 Windows 集合 API 将您的查询范围限定到您的特定产品(应用程序或附加组件)。发送请求后,您将收到一个响应,其中包含一个数组项 CollectionItemContractV6
,其中包含 acquireDate
等您可能会使用的参数。然后您可以为在正确时间范围内安装您应用的用户解锁该功能。
您可以按照以下步骤使用此 API:
- Configure a Web application in Azure AD.
- Associate your Azure AD client ID with your application in the Windows Dev Center dashboard.
- In your service, create Azure AD access tokens that represent your publisher identity.
- In client-side code in your Windows app, create a Windows Store ID key that represents the identity of the current user, and pass the Windows Store ID key back to your service.
- After you have the required Azure AD access token and Windows Store ID key, call the Windows Store collection API or purchase API from your service.
有关更多详细信息,您可以查看 Query for products,其中包括请求和响应示例。