語言

CurrentApp 類別

定義

定義可用來取得授權和列出目前應用程式的相關信息,以及執行應用程式內產品購買的方法和屬性。

注意

CurrentApp 類別和 Windows.ApplicationModel.Store 命名空間中的其他類型不再使用新功能更新。 如果您的項目目標 Windows 10 年度版 (10.0;組建 14393) 或更新版本中的 Visual Studio(也就是,您是以 Windows 10 版本 1607 或更新版本為目標),建議您改用 Windows.Services.Store 命名空間。 如需詳細資訊,請參閱 應用程式內購買和試用版。 CurrentApp 類別不支援在 Windows 傳統型應用程式中使用 傳統型網橋,或在 合作夥伴中心 中使用開發沙盒的應用程式或遊戲中(例如,這是與 Xbox Live 整合的任何遊戲的情況)。 這些產品必須使用 Windows.Services.Store 命名空間來實作應用程式內購買和試用版。

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
繼承
Object Platform::Object IInspectable CurrentApp
屬性

Windows 需求

規格需求 Description
裝置系列
Windows 10 (已於 10.0.10240.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)

備註

此物件會從 Microsoft Store 取得其數據,因此您必須擁有開發人員帳戶,而且應用程式必須在 Microsoft Store 中發佈。 提交至 Microsoft Store 之前,您可以使用這個類別的模擬版本來測試程式代碼(其狀態是從 XML 檔案初始化)。 請參閱 CurrentAppSimulator。

版本歷程記錄

Windows 版本 SDK 版本 增加值
1511 10586 GetCustomerCollectionsIdAsync
1511 10586 GetCustomerPurchaseIdAsync

屬性

名稱 Description
AppId

取得 Windows 市集在 Windows 市集中認證列出時,Windows 市集所產生的 GUID。

注意

一旦您的應用程式在 Windows 市集中,未來的應用程式更新或變更應用程式描述將不會產生 CurrentApp.AppId 的變更。

LicenseInformation

取得目前應用程式的授權元數據。

LinkUri

取得 Windows 市集 Web 目錄中應用程式清單頁面的統一資源識別碼(URI)。

方法

名稱 Description
GetAppPurchaseCampaignIdAsync()

擷取目前應用程式的促銷活動標識碼。

GetAppReceiptAsync()

要求購買應用程式及任何應用程式內產品的所有收據。 如需如何使用收據資訊的範例,請參閱 使用收據來驗證產品購買。

GetCustomerCollectionsIdAsync(String, String)

擷取可用來查詢產品權利或取用目前使用者所擁有的產品權利Microsoft市集標識符密鑰。

GetCustomerPurchaseIdAsync(String, String)

擷取Microsoft市集標識符密鑰,此密鑰可用來代表目前使用者授與免費產品的權利。

GetProductReceiptAsync(String)

要求指定之產品標識碼的收據。 如需如何使用收據資訊的範例,請參閱 使用收據來驗證產品購買。

GetUnfulfilledConsumablesAsync()

傳回尚未回報至 Microsoft Store 的已購買消費性應用程式內產品清單。

LoadListingInformationAsync()

以異步方式載入應用程式的清單資訊。

傳回的 ListingInformation 物件包含使用者目前所在市場的特定清單資訊(例如名稱、價格、年齡分級)。 此外,也會提供應用程式內可用產品的清單資訊。

LoadListingInformationByKeywordsAsync(IIterable<String>)

以異步方式載入應用程式清單資訊,傳回 ProductListings 集合中符合所有提供關鍵詞的功能和產品。

LoadListingInformationByProductIdsAsync(IIterable<String>)

以異步方式載入應用程式清單資訊,傳回 ProductListings 集合中符合任何指定產品識別碼的功能和產品。

ReportConsumableFulfillmentAsync(String, Guid)

通知Microsoft市集購買消費性附加元件(也稱為應用程式內產品或 IAP)已完成,且使用者有權存取內容。

ReportProductFulfillment(String)

通知Microsoft市集應用程式已完成應用程式內產品。 除非應用程式已使用此方法確認履行,否則無法重新購買本產品。

RequestAppPurchaseAsync(Boolean)

Important

在提升級應用程式中不支援應用程式內購買功能。

要求購買完整的應用程式授權。

RequestProductPurchaseAsync(String, Boolean)

Important

在提升級應用程式中不支援應用程式內購買功能。

注意

[RequestProductPurchaseAsync(String, Boolean) 可能會在Windows 8.1之後變更或無法使用版本。 請改用 RequestProductPurchaseAsync(String)。

要求購買附加元件(也稱為應用程式內產品或 IAP)。 此外,呼叫此方法會顯示用來透過 Microsoft Store 完成交易的 UI。

RequestProductPurchaseAsync(String, String, ProductPurchaseDisplayProperties)

Important

在提升級應用程式中不支援應用程式內購買功能。

要求購買附加元件(也稱為應用程式內產品或 IAP)。 此外,呼叫此方法會顯示用來透過 Microsoft Store 完成交易的 UI。 此多載包含參數,可用來在市集中單一產品專案所代表的大型應用程式內購買目錄中,顯示特定供應專案的詳細數據。

RequestProductPurchaseAsync(String)

Important

在提升級應用程式中不支援應用程式內購買功能。

要求購買附加元件(也稱為應用程式內產品或 IAP)。 此外,呼叫此方法會顯示用來透過 Microsoft Store 完成交易的 UI。

適用於

另請參閱