应用内购买移除广告 [英] In-App Purchase remove ads

查看:17
本文介绍了应用内购买移除广告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的一个应用中植入了广告,并且我想创建一个应用内购买功能来移除它们.我该怎么做.

I have implemented ads in one of my apps and I want to make a in-app purchase feature to remove them. How would I do this.

我在想一个简单的方法,就是在购买后通过隐藏广告来隐藏广告.这可以工作还是有更简单/更好的方法?

I was thinking a simple way, was to hide the ads by making in invisible, after purchase. Could that work or is there an easier/better way?

我不知道如何将应用内功能用于任何目的.谁能告诉我如何编写代码或阅读相关内容?

I have no idea how to use the in-app feature for any purpose. Could anyone show me the way to code or something to read on this?

推荐答案

这首先取决于您如何插入广告.如果您是通过代码完成的,那么只需在插入广告的代码周围放置一个 if(removed ads == false).

It depends on how you inserted the ads in the first place. If you did it via code, then just put an if(removed ads == false) around the code that inserts ads.

如果您是通过 XML 完成的,那么最好的方法是复制您的 XML,不使用 adview,并在您的代码中使用,如果围绕您的所有 setContentView(R.layout.example)

If you did it via XML, then the best way to do it is to copy out your XML, without the adview, and in your code use if surrounding all of your setContentView(R.layout.example)

这是我的意思的一个例子

Here's an example of what I mean

if (adsDisabled == true){
    setContentView(R.layout.mainNoAds)
} else{
    setContentView(R.layout.main
}

应用内购买 -

http://developer.android.com/guide/google/play/billing/billing_overview.html

在这篇文章中,我假设您使用的是 admob,但所有公司都应该如此

In this post I assumed you are using admob, but the same should be true for all companies

最后一件事 - 使用 adView.View.GONE IS 不好的做法**不要**这样做

On last thing - using adView.View.GONE IS bad practice **DO NOT ** do that

这篇关于应用内购买移除广告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆