CurrentApp Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Defines methods and properties you can use to get license and listing info about the current app and perform in-app product purchases.
Note
The CurrentApp class and the other types in the Windows.ApplicationModel.Store namespace are no longer being updated with new features. If your project targets Windows 10 Anniversary Edition (10.0; Build 14393) or a later release in Visual Studio (that is, you are targeting Windows 10, version 1607, or later), we recommend that you use the Windows.Services.Store namespace instead. For more information, see In-app purchases and trials. The CurrentApp class is not supported in Windows desktop applications that use the Desktop Bridge or in apps or games that use a development sandbox in Partner Center (for example, this is the case for any game that integrates with Xbox Live). These products must use the Windows.Services.Store namespace to implement in-app purchases and trials.
public ref class CurrentApp abstract sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class CurrentApp final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public static class CurrentApp
Public Class CurrentApp
- Inheritance
- Attributes
Windows requirements
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
Remarks
This object obtains its data from the Microsoft Store, so you must have a developer account and the app must be published in the Microsoft Store. Before submitting to the Microsoft Store, you can test your code with a simulated version of this class (whose state is initialized from an XML file). See CurrentAppSimulator.
Version history
Windows version | SDK version | Value added |
---|---|---|
1511 | 10586 | GetCustomerCollectionsIdAsync |
1511 | 10586 | GetCustomerPurchaseIdAsync |
Properties
AppId |
Gets the GUID generated by the Windows Store when your app has been certified for listing in the Windows Store. Note Once your app is in the Windows Store, future app updates or changes to the app description will not result in a change to the CurrentApp.AppId. |
LicenseInformation |
Gets the license metadata for the current app. |
LinkUri |
Gets the Uniform Resource Identifier (URI) of the app's listing page in the web catalog of the Windows Store. |
Methods
GetAppPurchaseCampaignIdAsync() |
Retrieves the promotion campaign ID for the current app. |
GetAppReceiptAsync() |
Requests all receipts for the purchase of the app and any in-app products. For examples of how receipt information can be used, see Using receipts to verify product purchases. |
GetCustomerCollectionsIdAsync(String, String) |
Retrieves a Microsoft Store ID key that can be used to query for product entitlements or to consume product entitlements that are owned by the current user. |
GetCustomerPurchaseIdAsync(String, String) |
Retrieves a Microsoft Store ID key that can be used to grant entitlements for free products on behalf of the current user. |
GetProductReceiptAsync(String) |
Requests the receipt for the specified product ID. For examples of how receipt information can be used, see Using receipts to verify product purchases. |
GetUnfulfilledConsumablesAsync() |
Returns a list of purchased consumable in-app products that have not been reported to the Microsoft Store as fulfilled. |
LoadListingInformationAsync() |
Loads the app's listing information asynchronously. The returned ListingInformation object contains listing information (for example, name, price, age rating) specific to the market the user currently resides in. Additionally, the listing information for available in-app products is also provided. |
LoadListingInformationByKeywordsAsync(IIterable<String>) |
Loads the app listing information asynchronously, returning features and products in the ProductListings collection that match all supplied keywords. |
LoadListingInformationByProductIdsAsync(IIterable<String>) |
Loads the app listing information asynchronously, returning features and products in the ProductListings collection that match any of the given products IDs. |
ReportConsumableFulfillmentAsync(String, Guid) |
Notifies the Microsoft Store that the purchase of a consumable add-on (also called an in-app product or IAP) is fulfilled and that the user has the right to access the content. |
ReportProductFulfillment(String) |
Notifies the Microsoft Store that the application has fulfilled the in-app product. This product cannot be re-purchased until the app has confirmed fulfillment using this method. |
RequestAppPurchaseAsync(Boolean) |
Requests the purchase of a full app license. |
RequestProductPurchaseAsync(String, Boolean) |
Note [RequestProductPurchaseAsync(String, Boolean) may be altered or unavailable for releases after Windows 8.1. Instead, use RequestProductPurchaseAsync(String). Requests the purchase of an add-on (also called an in-app product or IAP). Additionally, calling this method displays the UI that is used to complete the transaction via the Microsoft Store. |
RequestProductPurchaseAsync(String, String, ProductPurchaseDisplayProperties) |
Requests the purchase of an add-on (also called an in-app product or IAP). Additionally, calling this method displays the UI that is used to complete the transaction via the Microsoft Store. This overload includes parameters you can use to display details for a specific offer within a large catalog of in-app purchases that is represented by a single product entry in the Store. |
RequestProductPurchaseAsync(String) |
Requests the purchase of an add-on (also called an in-app product or IAP). Additionally, calling this method displays the UI that is used to complete the transaction via the Microsoft Store. |