CurrentAppSimulator Class

Definition

Defines methods and properties used to instantiate an object that you can use to get simulated license info during testing.

Note

The CurrentAppSimulator 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 CurrentAppSimulator 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 CurrentAppSimulator 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 CurrentAppSimulator 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 CurrentAppSimulator
Public Class CurrentAppSimulator
Inheritance
Object Platform::Object IInspectable CurrentAppSimulator
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

Until the app has been listed in the Microsoft Store, the CurrentApp object won't work in the app. Use the CurrentAppSimulator to test your app's licensing and in-app products while you develop your app. After you test your app, and before you submit it to the Microsoft Store, you must replace the instances of CurrentAppSimulator with CurrentApp. Your app will fail certification if it uses CurrentAppSimulator.

When the CurrentAppSimulator is used, the initial licensing state of the app is described in a file named WindowsStoreProxy.xml. CurrentAppSimulator methods that alter the license state, for example by buying a license or handling an in-app purchase, only update the license state of the object in memory. The contents of WindowsStoreProxy.xml are not changed. When the app starts again, the license state reverts to what is described in WindowsStoreProxy.xml.

For more information about the WindowsStoreProxy.xml file, see Using the WindowsStoreProxy.xml file with CurrentAppSimulator.

Properties

AppId

Gets a simulated app ID. Since CurrentAppSimulator is intended only for testing during app development, the returned CurrentAppSimulator.AppId will contain only 0's.

Once your app is listed on the Windows Store, CurrentApp.AppId will get the GUID generated during app on-boarding and used to list your app within the Windows Store catalog.

Note

App updates or changes to the app description will not result in a change to the CurrentApp.AppId.

LicenseInformation

Gets the simulated license metadata for the current app as provided by the simulation.

LinkUri

Gets the simulated Uniform Resource Identifier (URI) that represents a Microsoft Store listing page for the current app.

Methods

GetAppPurchaseCampaignIdAsync()

Retrieves the promotion campaign ID for the current app.

GetAppReceiptAsync()

Creates the async operation that the user can use to simulate requesting all receipts for this app and any in-app product purchases. For examples of how receipt information can be used, see Using receipts to verify product purchases.

GetProductReceiptAsync(String)

Creates the async operation that the user can use to simulate requesting 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 fulfilled locally.

LoadListingInformationAsync()

Loads the simulated app 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, listing information for products available via in-app products is also provided.

Note

For simulation purposes, this method uses the element in the WindowsStoreProxy.xml file as the data source for the members of the returned object. For more info, see the code examples in CurrentAppSimulator.

LoadListingInformationByKeywordsAsync(IIterable<String>)

Loads the simulated app listing information asynchronously, returning in-app products in the ProductListings collection that match all supplied keywords.

LoadListingInformationByProductIdsAsync(IIterable<String>)

Loads the simulated app listing information asynchronously, returning available in-app products in the ProductListings collection that match any of the given products IDs.

ReloadSimulatorAsync(StorageFile)

Reloads the simulator using a StorageFile containing the WindowsStoreProxy.xml file.

If you do not call this method to load your own file, the simulator will create/load (but not overwrite) a WindowsStoreProxy.xml file containing a set of default values.

ReportConsumableFulfillmentAsync(String, Guid)

Simulates notifying 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.

RequestAppPurchaseAsync(Boolean)

Creates the async operation that simulates a user request to buy a full license for the current app.

RequestProductPurchaseAsync(String)

Creates the async operation that displays the UI that is used to simulate the purchase of an add-on (also called an in-app product or IAP) from the Microsoft Store.

RequestProductPurchaseAsync(String, Boolean)

Note

[RequestProductPurchaseAsync(String, Boolean) may be altered or unavailable for releases after Windows 8.1. Instead, use RequestProductPurchaseAsync(String).

Creates the async operation that displays the UI that is used to simulate the purchase of an add-on (also called an in-app product or IAP) from the Microsoft Store.

RequestProductPurchaseAsync(String, String, ProductPurchaseDisplayProperties)

Creates the async operation that displays the UI that is used to simulate the purchase of an add-on (also called an in-app product or IAP) from 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.

Applies to

See also