- Valid for Windows Phone 8.1, Dev Studio 2013
You can access isolated storage files using the "ISETool" located here: "Program Files (x86) \ Microsoft SDK \ Windows Phone \ v8.0 \ Tools \ IsolatedStorageExplorerTool". How to use the isolated storage tool for Windows Phone 8 . After copying them to a folder on your computer, you will have a subfolder of "IsolatedStore". Inside "\ Microsoft \ Windows Store \ ApiData" you will find "WindowsStoreProxy.xml":
<?xml version="1.0" encoding="utf-16" ?> <CurrentApp> <ListingInformation> <App> <AppId>00000000-0000-0000-0000-000000000000</AppId> <LinkUri>http://apps.microsoft.com/webpdp/app/00000000-0000-0000-0000-000000000000</LinkUri> <CurrentMarket>en-US</CurrentMarket> <AgeRating>3</AgeRating> <MarketData xml:lang="en-us"> <Name>AppName</Name> <Description>AppDescription</Description> <Price>1.00</Price> <CurrencySymbol>$</CurrencySymbol> <CurrencyCode>USD</CurrencyCode> </MarketData> </App> <Product ProductId="1" LicenseDuration="0" ProductType="Durable"> <MarketData xml:lang="en-us"> <Name>Product1Name</Name> <Price>1.00</Price> <CurrencySymbol>$</CurrencySymbol> <CurrencyCode>USD</CurrencyCode> </MarketData> </Product> <Product ProductId="2" LicenseDuration="0" ProductType="Consumable"> <MarketData xml:lang="en-us"> <Name>Product2Name</Name> <Price>1.00</Price> <CurrencySymbol>$</CurrencySymbol> <CurrencyCode>USD</CurrencyCode> </MarketData> </Product> </ListingInformation> <LicenseInformation> <App> <IsActive>true</IsActive> <IsTrial>true</IsTrial> </App> <Product ProductId="1"> <IsActive>true</IsActive> </Product> </LicenseInformation> <ConsumableInformation> <Product ProductId="2" TransactionId="00000000-0000-0000-0000-000000000000" Status="Active" /> </ConsumableInformation>
Copy this file to your resources folder and include it in your project. Modify the file, you need to change ProductId from "1" to "Your Product Identifier". You can remove the product with the product id = "2" if you do not need a consumable product in the application. Change the second license information to:
<LicenseInformation> <App> <IsActive>true</IsActive> <IsTrial>false</IsTrial> </App> <Product ProductId="Your Product ID"> <IsActive>false</IsActive> </Product> </LicenseInformation>
Make your application constructor look like this:
private static LicenseInformation licenseInformation=null; public App() { this.InitializeComponent(); this.Suspending += this.OnSuspending; #if DEBUG licenseInformation = CurrentAppSimulator.LicenseInformation; #else licenseInformation = CurrentApp.LicenseInformation; #endif licenseInformation.LicenseChanged += licenseInformation_LicenseChanged; }
Add event handler:
private static void licenseInformation_LicenseChanged() { if (licenseInformation.ProductLicenses["Your Product ID"].IsActive) {
Add something like this to the App class:
public static async void RequestFeatureXYZ() { if (!licenseInformation.ProductLicenses["Your Product ID"].IsActive) { try { #if DEBUG StorageFolder installFolder = await Package.Current.InstalledLocation.GetFolderAsync("Assets"); StorageFile appSimulatorStorageFile = await installFolder.GetFileAsync("WindowsStoreProxy.xml"); await CurrentAppSimulator.ReloadSimulatorAsync(appSimulatorStorageFile); PurchaseResults result = await CurrentAppSimulator.RequestProductPurchaseAsync("Your Product ID"); #else PurchaseResults result = await CurrentApp.RequestProductPurchaseAsync("Your Product ID"); #endif
And links ..
using Windows.Storage; using Windows.Storage.Streams; using Windows.ApplicationModel.Store; using System.ComponentModel;
source share