1
私は単純なuwpアプリケーション(Microsoft/Windowsストアで公開)です。メインページには広告(バナー)しかありません。ユーザーがアプリ内購入をしたときに広告を削除したい 私はすでにMicrosoftとMicrosoft Virtual Academyのチュートリアルに従っていますが、広告を削除することはできません。広告を取り除く(アプリ内購入)UWPアプリケーション
private async void removeAds_Click(object sender, RoutedEventArgs e)
{
if (!AppLicenseInformation.ProductLicenses["RemoveAdsOffer"].IsActive)
{
try
{
// The customer doesn't own this feature, so
// show the purchase dialog.
PurchaseResults results = await CurrentAppSimulator.RequestProductPurchaseAsync("RemoveAdsOffer");
//Check the license state to determine if the in-app purchase was successful.
if (results.Status == ProductPurchaseStatus.Succeeded)
{
removeAds.Visibility = Visibility.Collapsed;
Ad.Visibility = Visibility.Collapsed;
}
}
catch (Exception ex)
{
// The in-app purchase was not completed because
// an error occurred.
throw ex;
}
}
else
{
// The customer already owns this feature.
}
}
メインページの広告を削除するには、広告(Ad)とボタン(removeAds)があります。
広告とボタンは削除されますが、アプリの別のページに移動したり、アプリを閉じてからもう一度開くと、広告が再表示されます。
どうすればいいですか? –
うーんたびにページが読み込まだけ '場合(AppLicenseInformation.ProductLicenses [ "RemoveAdsOffer"]。のisActive) //広告 ' –
を削除ありがとうございます!私はテストします 私はこのコードを置く必要があり、everthingは仕事ですか? –