0
내 애플리케이션에 인앱 구매 옵션을 추가하려면 triyng입니다. 제품을 올바르게 구매할 수 있지만 구매하여 다른 페이지로 이동하여 구매 페이지로 돌아 가면 같은 제품을 다시 구매할 수 있습니다. 다른 제품을 구입할 때 오래된 제품을 구매하지 않은 상태가됩니다. 여기 인앱 구매 - 애플리케이션을 탐색 한 후에 다시 구매할 수 있습니다.
내 코드입니다 :Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
LicenseChangedEventHandler licenseChangeHandler = null;
public SatinAlma()
{
this.InitializeComponent();
}
private async Task LoadInAppPurchaseProxyFileAsync()
{
StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("Data");
StorageFile proxyFile = await proxyDataFolder.GetFileAsync("in-app-purchase.xml");
licenseChangeHandler = new LicenseChangedEventHandler(InAppPurchaseRefreshScenario);
CurrentAppSimulator.LicenseInformation.LicenseChanged += licenseChangeHandler;
await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile);
try
{
ListingInformation listing = await CurrentAppSimulator.LoadListingInformationAsync();
var PurchasePzl9 = listing.ProductListings["puzzle9"];
var PurchasePzl16 = listing.ProductListings["puzzle16"];
var PurchasePzl25 = listing.ProductListings["puzzle25"];
var PurchaseYardimseverlik = listing.ProductListings["yardimseverlik"];
var PurchaseTumpaket = listing.ProductListings["tumpaket"];
}
catch (Exception)
{
OAL_toast.showToast("LoadListingInformationAsync API call failed\n");
}
}
///////**i insert and delete this part nothing changed
//protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
//{
// if (licenseChangeHandler != null)
// {
// CurrentAppSimulator.LicenseInformation.LicenseChanged -= licenseChangeHandler;
// }
// base.OnNavigatingFrom(e);
//}
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
await LoadInAppPurchaseProxyFileAsync();
}
private void InAppPurchaseRefreshScenario()
{
}
private async void purchaseProduct()
{
LicenseInformation licenseInformation = CurrentAppSimulator.LicenseInformation;
if (!licenseInformation.ProductLicenses[stringPurchaseProduct].IsActive)
{
try
{
await CurrentAppSimulator.RequestProductPurchaseAsync(stringPurchaseProduct);
if (licenseInformation.ProductLicenses[stringPurchaseProduct].IsActive)
{
OAL_toast.showToast(stringPurchaseProduct + " purchased.");
this.Frame.Navigate(typeof(MainPage));
}
else
{
//OptimeAnimationLib.MsgBox(stringPurchaseProduct + " was not purchased.");
OAL_toast.showToast(stringPurchaseProduct + " was not purchased.");
}
}
catch (Exception)
{
OAL_toast.showToast("Unable to buy " + stringPurchaseProduct);
}
}
else
{
OAL_toast.showToast("you already own " + stringPurchaseProduct);
}
}
private void IMG_puzzle9_PointerReleased(object sender, PointerRoutedEventArgs e)
{
LicenseInformation licenseInformation = CurrentAppSimulator.LicenseInformation;
var productLicense = licenseInformation.ProductLicenses["puzzle9"];
if (productLicense.IsActive)
{
OAL_toast.showToast("you already own Puzzle 9.");
}
else
{
stringPurchaseProduct = "puzzle9";
purchaseProduct();
}
}
감사, 미안 내 영어 당신이 어떤 상점 활동을 다시 설정됩니다 스토어 시뮬레이터 XML 파일이 이동 때마다, 다시로드 것처럼 보이는
감사합니다, 실제로 나는 그것을 생각하지만 내가 왜 이걸 처리하지 못했습니다 :) 체크 isxmlloaded로드 된 전에 다시로드 할. 그리고 내 코드가 healty, 감사합니다보세요 말해 줄 수 :) –