好的,我将实现同样的事情,计划为 @reverse 告诉,但想确认其他开发人员的想法。但是,他的回答本身就是完整的,我只是给出了步骤:
ok, I am going to implement the same thing and planning it as @reverse has told but wanted to confirm how other developers are thinking. However, his answer is complete in itself, I am just giving the steps:
- 你已经实施了AdMob。
- 转到Playstore开发者帐户,然后在您的应用中添加应用内购买项目。让我们说:没有广告,名称在这里无关紧要,ID也很重要。
- 使用谷歌提供的IAB帮助文件,并按照如何使用它的步骤进行操作。请参阅此链接: http://developer.android .com / training / in-app-billing / preparation-iab-app.html
- 提供一个链接,用户可以为应用内元素支付无广告元素。
- 在应用程序启动检查时,通过使用上面的类检查用户是否已经支付/购买了应用内元素,将该标志标记为true。对于一致性和不重复检查,请将此变量保持为共享首选项为null。
- Null表示,您必须与Google Play一起检查以供用户购买。
- 如果购买,请将其标记为true,否则为false。
- 如果此标志为true:不显示广告。
- You already have AdMob implemented.
- Go to playstore developer account and in your app, Add an in-app purchase item. let's say: "No Ads", name doesn't matter here, an ID would matter.
- Use the IAB helper file provided by google and follow the steps how to use it. Refer to this link: http://developer.android.com/training/in-app-billing/preparing-iab-app.html
- Provide a link to pay for "No ads" in-app element by the user.
- On application startup check, by using the above class check whether user has already paid/purchased the in-app element, mark the flag to true. For consistency and unrepeated check, keep this variable in shared preference as null.
- Null means, You have to check with google play for purchase by the user.
- If purchased, mark it true else false.
- if this flag is true: do not show ads.