CurrentApp 類別

定義

定義可用來取得目前 App 的授權和清單資訊,以及執行應用程式內產品購買的方法和屬性。

注意

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

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 需求

裝置系列
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

屬性

AppId

取得 Windows 市集在應用程式通過認證以在 Windows 市集中列出時,由 Windows 市集產生的 GUID

注意

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

LicenseInformation

取得目前應用程式的授權中繼資料。

LinkUri

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

方法

GetAppPurchaseCampaignIdAsync()

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

GetAppReceiptAsync()

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

GetCustomerCollectionsIdAsync(String, String)

擷取 Microsoft Store 識別碼金鑰,可用來查詢產品權利,或取用目前使用者所擁有的產品權利。

GetCustomerPurchaseIdAsync(String, String)

擷取 Microsoft Store 識別碼金鑰,可用來代表目前使用者授與免費產品的權利。

GetProductReceiptAsync(String)

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

GetUnfulfilledConsumablesAsync()

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

LoadListingInformationAsync()

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

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

LoadListingInformationByKeywordsAsync(IIterable<String>)

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

LoadListingInformationByProductIdsAsync(IIterable<String>)

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

ReportConsumableFulfillmentAsync(String, Guid)

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

ReportProductFulfillment(String)

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

RequestAppPurchaseAsync(Boolean)

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

RequestProductPurchaseAsync(String)

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

RequestProductPurchaseAsync(String, Boolean)

注意

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

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

RequestProductPurchaseAsync(String, String, ProductPurchaseDisplayProperties)

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

適用於

另請參閱