CurrentAppSimulator
CurrentAppSimulator
CurrentAppSimulator
CurrentAppSimulator
Class
Definition
Defines methods and properties used to instantiate an object that you can use to get simulated license info during testing.
public : static class CurrentAppSimulatorpublic static class CurrentAppSimulatorPublic Static Class CurrentAppSimulator// You can use this class in JavaScript.
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
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
CurrentAppSimulator and the other types in the Windows.ApplicationModel.Store namespace are no longer being updated with new features, and we recommend that you use the Windows.Services.Store namespace instead. The Windows.Services.Store namespace supports the latest add-on types, such as Store-managed consumable add-ons and subscriptions, 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 was introduced in Windows 10, version 1607, and it can only be used in projects that target Windows 10 Anniversary Edition (10.0; Build 14393) or a later release in Visual Studio. For more information, see In-app purchases and trials.
Properties
AppId AppId AppId 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.
public : static PlatForm::Guid AppId { get; }public static Guid AppId { get; }Public Static ReadOnly Property AppId As Guid// You can use this property in JavaScript.
- Value
- PlatForm::Guid Guid Guid 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// You can use this property in JavaScript.
The license metadata for the current app as provided by the simulation.
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// You can use this property in JavaScript.
- Value
- Uri Uri Uri Uri
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<PlatForm::String> GetAppPurchaseCampaignIdAsync()public static IAsyncOperation<string> GetAppPurchaseCampaignIdAsync()Public Static Function GetAppPurchaseCampaignIdAsync() As IAsyncOperation( Of string )// You can use this method in JavaScript.
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.
- See Also
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<PlatForm::String> GetAppReceiptAsync()public static IAsyncOperation<string> GetAppReceiptAsync()Public Static Function GetAppReceiptAsync() As IAsyncOperation( Of string )// You can use this method in JavaScript.
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(String) GetProductReceiptAsync(String) GetProductReceiptAsync(String) 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.
public : static IAsyncOperation<PlatForm::String> GetProductReceiptAsync(PlatForm::String productId)public static IAsyncOperation<string> GetProductReceiptAsync(String productId)Public Static Function GetProductReceiptAsync(productId As String) As IAsyncOperation( Of string )// You can use this method in JavaScript.
- productId
- PlatForm::String String String String
The unique identifier for the product. This ID is that was specified when the product was submitted for the app to the Store.
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<IVectorView<UnfulfilledConsumable>> GetUnfulfilledConsumablesAsync()public static IAsyncOperation<IReadOnlyList<UnfulfilledConsumable>> GetUnfulfilledConsumablesAsync()Public Static Function GetUnfulfilledConsumablesAsync() As IAsyncOperation( Of IReadOnlyListUnfulfilledConsumable )// You can use this method in JavaScript.
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 ListingInformation 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 )// You can use this method in JavaScript.
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(IIterable)
LoadListingInformationByKeywordsAsync(IIterable)
LoadListingInformationByKeywordsAsync(IIterable)
LoadListingInformationByKeywordsAsync(IIterable)
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(IIterable<PlatForm::String> keywords)public static IAsyncOperation<ListingInformation> LoadListingInformationByKeywordsAsync(IEnumerable<String> keywords)Public Static Function LoadListingInformationByKeywordsAsync(keywords As IEnumerable<String>) As IAsyncOperation( Of ListingInformation )// You can use this method in JavaScript.
- keywords
- IIterable<PlatForm::String> IEnumerable<String> IEnumerable<String> IEnumerable<String>
The list of keywords by which to filter the ProductListings collection that is returned in the ListingInformation object.
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(IIterable)
LoadListingInformationByProductIdsAsync(IIterable)
LoadListingInformationByProductIdsAsync(IIterable)
LoadListingInformationByProductIdsAsync(IIterable)
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(IIterable<PlatForm::String> productIds)public static IAsyncOperation<ListingInformation> LoadListingInformationByProductIdsAsync(IEnumerable<String> productIds)Public Static Function LoadListingInformationByProductIdsAsync(productIds As IEnumerable<String>) As IAsyncOperation( Of ListingInformation )// You can use this method in JavaScript.
- productIds
- IIterable<PlatForm::String> IEnumerable<String> IEnumerable<String> IEnumerable<String>
The list of product IDs by which to filter the ProductListings collection.
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(StorageFile) ReloadSimulatorAsync(StorageFile) ReloadSimulatorAsync(StorageFile) 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.
public : static IAsyncAction ReloadSimulatorAsync(StorageFile simulatorSettingsFile)public static IAsyncAction ReloadSimulatorAsync(StorageFile simulatorSettingsFile)Public Static Function ReloadSimulatorAsync(simulatorSettingsFile As StorageFile) As IAsyncAction// You can use this method in JavaScript.
- simulatorSettingsFile
- StorageFile StorageFile StorageFile StorageFile
The WindowsStoreProxy.xml file that the simulator uses.
The async operation that reloads the simulator.
Remarks
For more information about using this method, see Using the WindowsStoreProxy.xml file with CurrentAppSimulator.
ReportConsumableFulfillmentAsync(String, Guid) ReportConsumableFulfillmentAsync(String, Guid) ReportConsumableFulfillmentAsync(String, Guid) ReportConsumableFulfillmentAsync(String, Guid)
Simulates notifying the Windows 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.
public : static IAsyncOperation<FulfillmentResult> ReportConsumableFulfillmentAsync(PlatForm::String productId, PlatForm::Guid transactionId)public static IAsyncOperation<FulfillmentResult> ReportConsumableFulfillmentAsync(String productId, Guid transactionId)Public Static Function ReportConsumableFulfillmentAsync(productId As String, transactionId As Guid) As IAsyncOperation( Of FulfillmentResult )// You can use this method in JavaScript.
- productId
- PlatForm::String String String String
The product ID of the consumable add-on to report as fulfilled.
- transactionId
- PlatForm::Guid Guid Guid Guid
The transaction ID for the simulated purchase of the consumable add-on.
A FulfillmentResult value that indicates the fulfillment status for the consumable add-on.
Remarks
The product ID is the string that the app uses to identify the add-on. You enter the product ID when submitting your add-on in the Windows Dev Center dashboard, where it is associated with the description, price tier and lifetime. For more information, see How to use product IDs for add-ons in your code.
A unique transaction ID is required for each instance of a consumable product that has been purchased more than once.
RequestAppPurchaseAsync(Boolean) RequestAppPurchaseAsync(Boolean) RequestAppPurchaseAsync(Boolean) RequestAppPurchaseAsync(Boolean)
Creates the async operation that simulates a user request to buy a full license for the current app.
public : static IAsyncOperation<PlatForm::String> RequestAppPurchaseAsync(bool includeReceipt)public static IAsyncOperation<string> RequestAppPurchaseAsync(Boolean includeReceipt)Public Static Function RequestAppPurchaseAsync(includeReceipt As Boolean) As IAsyncOperation( Of string )// You can use this method in JavaScript.
- includeReceipt
- bool Boolean Boolean Boolean
Determines if the method should return the receipts for this app.
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(String) RequestProductPurchaseAsync(String) RequestProductPurchaseAsync(String) 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 Windows Store.
public : static IAsyncOperation<PurchaseResults> RequestProductPurchaseAsync(PlatForm::String productId)public static IAsyncOperation<PurchaseResults> RequestProductPurchaseAsync(String productId)Public Static Function RequestProductPurchaseAsync(productId As String) As IAsyncOperation( Of PurchaseResults )// You can use this method in JavaScript.
- productId
- PlatForm::String String String String
The product ID (as defined by the simulation) of the add-on to purchase.
A PurchaseResults that contains the results of the simulated in-app product purchase request.
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.
You can see an example of how to use this method in our code sample.
- See Also
RequestProductPurchaseAsync(String, Boolean) RequestProductPurchaseAsync(String, Boolean) RequestProductPurchaseAsync(String, Boolean) 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 Windows Store.
public : static IAsyncOperation<PlatForm::String> RequestProductPurchaseAsync(PlatForm::String productId, bool includeReceipt)public static IAsyncOperation<string> RequestProductPurchaseAsync(String productId, Boolean includeReceipt)Public Static Function RequestProductPurchaseAsync(productId As String, includeReceipt As Boolean) As IAsyncOperation( Of string )// You can use this method in JavaScript.
- productId
- PlatForm::String String String String
The product ID (as defined by the simulation) of the add-on to purchase.
- includeReceipt
- bool Boolean Boolean Boolean
Determines if the method should return the receipts for the specified productId.
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
The remarks for RequestProductPurchaseAsync(String) also apply to this overload.
To confirm whether the product license is active after a successful call to this overload, use the LicenseInformation.IsActive property.
You can see an example of how to use this method in our code sample.
- See Also
RequestProductPurchaseAsync(String, String, ProductPurchaseDisplayProperties) RequestProductPurchaseAsync(String, String, ProductPurchaseDisplayProperties) RequestProductPurchaseAsync(String, String, ProductPurchaseDisplayProperties) 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 Windows 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.
public : static IAsyncOperation<PurchaseResults> RequestProductPurchaseAsync(PlatForm::String productId, PlatForm::String offerId, ProductPurchaseDisplayProperties displayProperties)public static IAsyncOperation<PurchaseResults> RequestProductPurchaseAsync(String productId, String offerId, ProductPurchaseDisplayProperties displayProperties)Public Static Function RequestProductPurchaseAsync(productId As String, offerId As String, displayProperties As ProductPurchaseDisplayProperties) As IAsyncOperation( Of PurchaseResults )// You can use this method in JavaScript.
- productId
- PlatForm::String String String String
The product ID (as defined by the simulation) of the add-on to purchase.
- offerId
- PlatForm::String String String String
The specific in-app product within the large purchase catalog represented on the Windows Store by the productId. This value correlates with the content your app is responsible for fulfilling. The Windows Store only uses this parameter value to itemize the PurchaseResults.
- displayProperties
- ProductPurchaseDisplayProperties ProductPurchaseDisplayProperties ProductPurchaseDisplayProperties ProductPurchaseDisplayProperties
The name of the in-app product that is displayed to the user at time of purchase.
A PurchaseResults that contains the results of the simulated in-app product purchase request.
Remarks
The remarks for RequestProductPurchaseAsync(String) also apply to this overload.