1
저는 간단한 uwp 앱 (Microsoft/Windows Store에서 게시 됨)이며 메인 페이지에는 광고 (배너) 만 있습니다. 사용자가 인앱 구매를 할 때 광고를 삭제하고 싶습니다. 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)이 있습니다.
광고 및 버튼이 제거되었지만 내 앱의 다른 페이지로 이동하거나 앱을 닫았다가 다시 열면 광고가 다시 나타납니다.
그리고 어떻게해야합니까? –
음 ... 페이지가로드 될 때마다 if (AppLicenseInformation.ProductLicenses [ "RemoveAdsOffer"]. IsActive) // 광고 제거 ' –
감사합니다! 나는 테스트 할 것이다 나는이 코드를 넣기 만하면되고, 모든 것이 작동 하는가? –