我已经开始将Airpushes横幅广告“AdView”集成到我的应用程序中并使其运行良好,但我知道如果用户购买了我的捐赠密钥,我希望能够禁用广告,我已经设置了这个如果用户通过共享首选项拥有密钥,则设置。
但是,当我执行以下操作时,广告仍会显示,在我的创建中,我有:
AdView ad = (AdView) findViewById(R.id.guideAdView);
if (AppPreferences.getPrefs().getBoolean("full", false)){
ad.setVisibility(View.GONE);
}
AdCallbackListener adCallbackListener = new AdCallbackListener() {
@Override
public void onSDKIntegrationError(String message) {
// Here you will receive message from SDK if it detects any
// integration issue.
}
public void onSmartWallAdShowing() {
// This will be called by SDK when it’s showing any of the
// SmartWall ad.
}
@Override
public void onSmartWallAdClosed() {
// This will be called by SDK when the SmartWall ad is closed.
}
@Override
public void onAdError(String message) {
// This will get called if any error occurred during ad serving.
}
@Override
public void onAdCached(AdType arg0) {
// This will get called when an ad is cached.
}
@Override
public void onVideoAdFinished() {
// TODO Auto-generated method stub
}
@Override
public void onVideoAdShowing() {
// TODO Auto-generated method stub
}
};
if (airPlay == null)
airPlay = new AirPlay(this, adCallbackListener, false);
我知道if (AppPreferences.getPrefs().getBoolean("full", false))
工作正常,因为如果用户确实拥有完整密钥,则会在活动中使用其他位置来显示其他信息。
所以问题是为什么上述内容对adView不起作用?
答案 0 :(得分:0)
我从未使用过airpush,但如果用户有密钥,为什么不运行广告代码。
如果不显示广告,则无需设置所有听众和新的AirPlay对象。
e.g:
if (AppPreferences.getPrefs().getBoolean("full", false)){
// Do not show ads
AdView ad = (AdView) findViewById(R.id.guideAdView);
ad.setVisibility(View.GONE);
} else {
// Show Ads
// Set up listener (omitted from this example for clarity)
if (airPlay == null) airPlay = new AirPlay(this, adCallbackListener, false);
}