Blendester
Blendester

Reputation: 1653

How to check the first date an app is installed?

I have a paid app and want to offer it as free for a few days in the Store. But only for those who installed it during these special days I want to show ads.

How can I check if a user installed the app in a specific time range?

I thought of these solutions:

But these won't work now.

Thanks.

Upvotes: 1

Views: 1094

Answers (2)

Zhendong Wu - MSFT
Zhendong Wu - MSFT

Reputation: 1829

You can use Windows collection API to scope your query to your particular product (app or add-on). After sending request, you will receive a response including an array item CollectionItemContractV6 which contains the parameters like acquireDate and some others which you're likely to use. Then you can unlock the feature to the user who installed your app within the correct time range.

You may follow the steps below to use this API:

  1. Configure a Web application in Azure AD.
  2. Associate your Azure AD client ID with your application in the Windows Dev Center dashboard.
  3. In your service, create Azure AD access tokens that represent your publisher identity.
  4. 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.
  5. 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.

For more details, you could check Query for products which includes both the request and response sample.

Upvotes: 1

Romasz
Romasz

Reputation: 29792

You can get App receipt from the store (here is how it can look like) and parse the PurchaseDate of your product. However this will return the date when the app has been first installed, if the user has reinstalled the app, then it will return the date of the very first installation (first 'purchase' from the store).

You can also have a value in LocalSettings that will be responsible for remembering the date of first run of the app. But this doesn't mean the date of installation - user can install the app and run it after a month. Also when user reinstalls the app, you will get the new value.

Upvotes: 5

Related Questions