CurrentAppSimulator CurrentAppSimulator CurrentAppSimulator CurrentAppSimulator Class

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

Syntax

Declaration

public static class CurrentAppSimulatorpublic static class CurrentAppSimulatorPublic Static Class CurrentAppSimulator

Remarks

Until the app has been listed in the Windows 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 Windows 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.

Note

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. For more information, see In-app purchases and trials.

Properties summary

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

Once your app is listed on the Windows Store, 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 AppId.

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

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

Methods summary

Retrieves the promotion campaign ID for the current app.

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.

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.

Returns a list of purchased consumable in-app products that have not been fulfilled locally.

Loads the simulated app listing information asynchronously.

The returned LoadListingInformationAsync() object contains listing information (e.g. 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.

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

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

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.

Simulates notifying the Windows Store that the purchase of a consumable in-app product is fulfilled and that the user has the right to access the content.

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

Creates the async operation that displays the UI that is used to simulate the purchase of in-app product from the Windows Store.

Note

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

Creates the async operation that displays the UI that is used to simulate the purchase of an in-app product from the Windows Store.

Creates the async operation that displays the UI that is used to simulate the purchase of an in-app product from the Windows Store.

The resulting RequestProductPurchaseAsync(System.String,System.Boolean) object includes the parameters required to display details for a specific offer within a large catalog of in-app products that is represented by a single entry in the Windows Store.

Properties

  • AppId
    AppId
    AppId
    AppId

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

    Once your app is listed on the Windows Store, 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 AppId.

    public static Guid AppId { get; }public static Guid AppId { get; }Public Static ReadOnly Property AppId As Guid

    Property Value

    • System.Guid
      System.Guid
      System.Guid
      System.Guid

      The GUID that identifies the app in the Windows Store.

    Remarks

    Uses the AppId element in the WindowsStoreProxy.xml file as the data source for the members of the returned object. For more information, see Using the WindowsStoreProxy.xml file with CurrentAppSimulator.

  • LicenseInformation
    LicenseInformation
    LicenseInformation
    LicenseInformation

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

    public static LicenseInformation LicenseInformation { get; }public static LicenseInformation LicenseInformation { get; }Public Static ReadOnly Property LicenseInformation As LicenseInformation

    Property Value

    Remarks

    Uses the LicenseInformation element in the WindowsStoreProxy.xml file as the data source for the members of the returned object. For more information, see Using the WindowsStoreProxy.xml file with CurrentAppSimulator.

    This API does not require a network connection.

  • LinkUri
    LinkUri
    LinkUri
    LinkUri

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

    public static Uri LinkUri { get; }public static Uri LinkUri { get; }Public Static ReadOnly Property LinkUri As Uri

    Property Value

    • The Uniform Resource Identifier (URI) of the Windows Store listing page for the current app as defined by the simulation.

    Remarks

    Gets the value of the LinkUri element in the WindowsStoreProxy.xml file. For more information, see Using the WindowsStoreProxy.xml file with CurrentAppSimulator.

Methods

  • GetAppPurchaseCampaignIdAsync()
    GetAppPurchaseCampaignIdAsync()
    GetAppPurchaseCampaignIdAsync()
    GetAppPurchaseCampaignIdAsync()

    Retrieves the promotion campaign ID for the current app.

    public static IAsyncOperation<string> GetAppPurchaseCampaignIdAsync()public static IAsyncOperation<string> GetAppPurchaseCampaignIdAsync()Public Static Function GetAppPurchaseCampaignIdAsync() As IAsyncOperation( Of string )

    Returns

    • The advertising campaign ID for your app.

    Remarks

    Starting in Windows 10, you can seed the installation URL for your app with an ID that represents a custom promotion campaign. This enables you to publicize the installation URL in different locations and use the campaign ID to determine which location the customer clicked on the installation URL. Use the GetAppPurchaseCampaignIdAsync() method to retrieve the campaign ID for the current app. For more information about custom app promotion campaigns, see Create a custom app promotion campaign.

  • GetAppReceiptAsync()
    GetAppReceiptAsync()
    GetAppReceiptAsync()
    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.

    public static IAsyncOperation<string> GetAppReceiptAsync()public static IAsyncOperation<string> GetAppReceiptAsync()Public Static Function GetAppReceiptAsync() As IAsyncOperation( Of string )

    Returns

    • An XML-formatted string that contains all receipts for this app and any in-app product purchases.

    Remarks

    For more information about the contents of the receipt, see Using receipts to verify product purchases.

  • GetProductReceiptAsync(System.String)
    GetProductReceiptAsync(System.String)
    GetProductReceiptAsync(System.String)
    GetProductReceiptAsync(System.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.

    public static IAsyncOperation<string> GetProductReceiptAsync(System.String productId)public static IAsyncOperation<string> GetProductReceiptAsync(System.String productId)Public Static Function GetProductReceiptAsync(productId As System.String) As IAsyncOperation( Of string )

    Parameters

    • productId
      System.String
      System.String
      System.String
      System.String

      The unique identifier for the product. This ID is that was specified when the product was submitted for the app to the Store.

    Returns

    • An XML-formatted string that contains the receipt for the specified product ID.

    Remarks

    For more information about the contents of the receipt, see Using receipts to verify product purchases.

  • GetUnfulfilledConsumablesAsync()
    GetUnfulfilledConsumablesAsync()
    GetUnfulfilledConsumablesAsync()
    GetUnfulfilledConsumablesAsync()

    Returns a list of purchased consumable in-app products that have not been fulfilled locally.

    public static IAsyncOperation<UnfulfilledConsumable>> GetUnfulfilledConsumablesAsync()public static IAsyncOperation<UnfulfilledConsumable>> GetUnfulfilledConsumablesAsync()Public Static Function GetUnfulfilledConsumablesAsync() As IAsyncOperation( Of UnfulfilledConsumable )

    Returns

    • When the operation completes, a list of unfulfilled consumable in-app products (UnfulfilledConsumable objects) is returned. Each item in this list provides the product ID, offer ID, and transaction ID associated with a product.

  • LoadListingInformationAsync()
    LoadListingInformationAsync()
    LoadListingInformationAsync()
    LoadListingInformationAsync()

    Loads the simulated app listing information asynchronously.

    The returned LoadListingInformationAsync() object contains listing information (e.g. 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.

    public static IAsyncOperation<ListingInformation> LoadListingInformationAsync()public static IAsyncOperation<ListingInformation> LoadListingInformationAsync()Public Static Function LoadListingInformationAsync() As IAsyncOperation( Of ListingInformation )

    Returns

    • The app listing information as defined by the simulation. If the method fails, it returns an HRESULT error code.

    Remarks

    Calling this method requires an internet connection.

  • LoadListingInformationByKeywordsAsync(Windows.Foundation.Collections.IIterable{System.String})
    LoadListingInformationByKeywordsAsync(Windows.Foundation.Collections.IIterable{System.String})
    LoadListingInformationByKeywordsAsync(Windows.Foundation.Collections.IIterable{System.String})
    LoadListingInformationByKeywordsAsync(Windows.Foundation.Collections.IIterable{System.String})

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

    public static IAsyncOperation<ListingInformation> LoadListingInformationByKeywordsAsync(Windows.Foundation.Collections.IIterable{System.String} keywords)public static IAsyncOperation<ListingInformation> LoadListingInformationByKeywordsAsync(Windows.Foundation.Collections.IIterable{System.String} keywords)Public Static Function LoadListingInformationByKeywordsAsync(keywords As Windows.Foundation.Collections.IIterable{System.String}) As IAsyncOperation( Of ListingInformation )

    Parameters

    Returns

    • The simulated app listing information, with ProductListings collection filtered by keywords. If the method fails, it returns an HRESULT error code. If no in-app products are found that match all of the given keywords, the ProductListings collection will be empty.

    Remarks

    Uses the ListingInformation element in the WindowsStoreProxy.xml file as the data source for the members of the returned objects. For more information, see Using the WindowsStoreProxy.xml file with CurrentAppSimulator.

    Calling this method requires an internet connection.

  • LoadListingInformationByProductIdsAsync(Windows.Foundation.Collections.IIterable{System.String})
    LoadListingInformationByProductIdsAsync(Windows.Foundation.Collections.IIterable{System.String})
    LoadListingInformationByProductIdsAsync(Windows.Foundation.Collections.IIterable{System.String})
    LoadListingInformationByProductIdsAsync(Windows.Foundation.Collections.IIterable{System.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.

    public static IAsyncOperation<ListingInformation> LoadListingInformationByProductIdsAsync(Windows.Foundation.Collections.IIterable{System.String} productIds)public static IAsyncOperation<ListingInformation> LoadListingInformationByProductIdsAsync(Windows.Foundation.Collections.IIterable{System.String} productIds)Public Static Function LoadListingInformationByProductIdsAsync(productIds As Windows.Foundation.Collections.IIterable{System.String}) As IAsyncOperation( Of ListingInformation )

    Parameters

    • productIds

      The list of product IDs by which to filter the ProductListings collection.

    Returns

    • The simulated app listing information, with ProductListings collection filtered by product IDs. If the method fails, it returns an HRESULT error code. If no in-app products are found that match the given product IDs, the ProductListings collection will be empty.

    Remarks

    Uses the ListingInformation element in the WindowsStoreProxy.xml file as the data source for the members of the returned objects. For more information, see Using the WindowsStoreProxy.xml file with CurrentAppSimulator.

    Calling this method requires an internet connection.

  • ReloadSimulatorAsync(Windows.Storage.StorageFile)
    ReloadSimulatorAsync(Windows.Storage.StorageFile)
    ReloadSimulatorAsync(Windows.Storage.StorageFile)
    ReloadSimulatorAsync(Windows.Storage.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.

    public static IAsyncAction ReloadSimulatorAsync(Windows.Storage.StorageFile simulatorSettingsFile)public static IAsyncAction ReloadSimulatorAsync(Windows.Storage.StorageFile simulatorSettingsFile)Public Static Function ReloadSimulatorAsync(simulatorSettingsFile As Windows.Storage.StorageFile) As IAsyncAction

    Parameters

    Returns

    Remarks

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

  • ReportConsumableFulfillmentAsync(System.String,System.Guid)
    ReportConsumableFulfillmentAsync(System.String,System.Guid)
    ReportConsumableFulfillmentAsync(System.String,System.Guid)
    ReportConsumableFulfillmentAsync(System.String,System.Guid)

    Simulates notifying the Windows Store that the purchase of a consumable in-app product is fulfilled and that the user has the right to access the content.

    public static IAsyncOperation<FulfillmentResult> ReportConsumableFulfillmentAsync(System.String productId,System.Guid transactionId)public static IAsyncOperation<FulfillmentResult> ReportConsumableFulfillmentAsync(System.String productId,System.Guid transactionId)Public Static Function ReportConsumableFulfillmentAsync(productId As System.String,transactionId As System.Guid) As IAsyncOperation( Of FulfillmentResult )

    Parameters

    • productId
      System.String
      System.String
      System.String
      System.String

      Identifies the consumable in-app product.

    • transactionId
      System.Guid
      System.Guid
      System.Guid
      System.Guid

      Identifies a simulated transaction that includes the purchase of the consumable in-app product (productId).

    Returns

    • A value that indicates the status of fulfillment for a simulated consumable in-app product purchase.

    Remarks

    A unique ID is required for each instance of a consumable that has been purchased more than once.

  • RequestAppPurchaseAsync(System.Boolean)
    RequestAppPurchaseAsync(System.Boolean)
    RequestAppPurchaseAsync(System.Boolean)
    RequestAppPurchaseAsync(System.Boolean)

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

    public static IAsyncOperation<string> RequestAppPurchaseAsync(System.Boolean includeReceipt)public static IAsyncOperation<string> RequestAppPurchaseAsync(System.Boolean includeReceipt)Public Static Function RequestAppPurchaseAsync(includeReceipt As System.Boolean) As IAsyncOperation( Of string )

    Parameters

    • includeReceipt
      System.Boolean
      System.Boolean
      System.Boolean
      System.Boolean

      Determines if the method should return the receipts for this app.

    Returns

    • If the includeReceipt parameter is set to true, this string contains XML that represents all receipts for the app and any in-app product purchases. If includeReceipt is set to false, this string is empty.

    Remarks

    This method returns a success value even if:

    • No network connection is available.
    • The user cancels out of the dialog.
    • The user's authentication fails. You should treat a success result as indicating the async process completed without errors. To ensure that the transaction itself was successful, check the LicenseInformation element in the returned receipt.

    For more information about the contents of the receipt, see Using receipts to verify product purchases.

  • RequestProductPurchaseAsync(System.String)
    RequestProductPurchaseAsync(System.String)
    RequestProductPurchaseAsync(System.String)
    RequestProductPurchaseAsync(System.String)

    Creates the async operation that displays the UI that is used to simulate the purchase of in-app product from the Windows Store.

    public static IAsyncOperation<PurchaseResults> RequestProductPurchaseAsync(System.String productId)public static IAsyncOperation<PurchaseResults> RequestProductPurchaseAsync(System.String productId)Public Static Function RequestProductPurchaseAsync(productId As System.String) As IAsyncOperation( Of PurchaseResults )

    Parameters

    • productId
      System.String
      System.String
      System.String
      System.String

      Specifies the id, as defined by the simulation, of the in-app product to buy.

    Returns

    • A PurchaseResults object containing transaction details for the provided productId.

    Remarks

    Uses the CurrentApp/ListingInformation/Product element in the WindowsStoreProxy.xml file with the ProductId attribute that matches ProductId as the data source for the members of the returned object. If the purchase succeeds, the license state is updated only in memory. The contents of WindowsStoreProxy.xml are not changed. For more information, see Using the WindowsStoreProxy.xml file with CurrentAppSimulator.

    Use the IsActive property to confirm that a product license is active after a successful RequestProductPurchaseAsync(System.String,System.Boolean) call.

    Note

    This method of confirming a successful purchase is only applicable to the RequestProductPurchaseAsync(System.String,System.Boolean) overloads that don't return a PurchaseResults object.

    You can see an example of how to use this method in our code sample.

  • RequestProductPurchaseAsync(System.String,System.Boolean)
    RequestProductPurchaseAsync(System.String,System.Boolean)
    RequestProductPurchaseAsync(System.String,System.Boolean)
    RequestProductPurchaseAsync(System.String,System.Boolean)
    Note

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

    Creates the async operation that displays the UI that is used to simulate the purchase of an in-app product from the Windows Store.

    public static IAsyncOperation<string> RequestProductPurchaseAsync(System.String productId,System.Boolean includeReceipt)public static IAsyncOperation<string> RequestProductPurchaseAsync(System.String productId,System.Boolean includeReceipt)Public Static Function RequestProductPurchaseAsync(productId As System.String,includeReceipt As System.Boolean) As IAsyncOperation( Of string )

    Parameters

    • productId
      System.String
      System.String
      System.String
      System.String

      Specifies the id, as defined by the simulation, of the in-app product to buy.

    • includeReceipt
      System.Boolean
      System.Boolean
      System.Boolean
      System.Boolean

      Determines if the method should return the receipts for the specified productId.

    Returns

    • A string providing in-app product purchase details for the provided productId. If includeReceipt is set true, the returned string will include a full receipt xml.

    Remarks

    Uses the CurrentApp/ListingInformation/Product element in the WindowsStoreProxy.xml file with the ProductId attribute that matches ProductId as the data source for the members of the returned object. If the purchase transaction succeeds, the license state is updated only in memory. The contents of WindowsStoreProxy.xml are not changed. For more information, see Using the WindowsStoreProxy.xml file with CurrentAppSimulator.

    Use the IsActive property to confirm that a product license is active after a successful RequestProductPurchaseAsync(System.String,System.Boolean) call.

    Note

    This method of confirming a successful purchase is only applicable to the RequestProductPurchaseAsync(System.String,System.Boolean) overloads that don't return a PurchaseResults object.

    You can see an example of how to use this method in our code sample.

  • RequestProductPurchaseAsync(System.String,System.String,Windows.ApplicationModel.Store.ProductPurchaseDisplayProperties)
    RequestProductPurchaseAsync(System.String,System.String,Windows.ApplicationModel.Store.ProductPurchaseDisplayProperties)
    RequestProductPurchaseAsync(System.String,System.String,Windows.ApplicationModel.Store.ProductPurchaseDisplayProperties)
    RequestProductPurchaseAsync(System.String,System.String,Windows.ApplicationModel.Store.ProductPurchaseDisplayProperties)

    Creates the async operation that displays the UI that is used to simulate the purchase of an in-app product from the Windows Store.

    The resulting RequestProductPurchaseAsync(System.String,System.Boolean) object includes the parameters required to display details for a specific offer within a large catalog of in-app products that is represented by a single entry in the Windows Store.

    public static IAsyncOperation<PurchaseResults> RequestProductPurchaseAsync(System.String productId,System.String offerId,Windows.ApplicationModel.Store.ProductPurchaseDisplayProperties displayProperties)public static IAsyncOperation<PurchaseResults> RequestProductPurchaseAsync(System.String productId,System.String offerId,Windows.ApplicationModel.Store.ProductPurchaseDisplayProperties displayProperties)Public Static Function RequestProductPurchaseAsync(productId As System.String,offerId As System.String,displayProperties As Windows.ApplicationModel.Store.ProductPurchaseDisplayProperties) As IAsyncOperation( Of PurchaseResults )

    Parameters

    Returns

    • The results of the in-app product purchase.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.StaticAttribute

Details

Assembly

Windows.ApplicationModel.Store.dll