I have started integrating Airpushes banner ad "AdView" into my application and have it working well, however I know want to be able to disable the ads if the user has bought my donation key, I have this already set up and just set if the user has the key via a shared preference.
However when I do the below the ad still displays, in my oncreate I have:
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);
I know the if (AppPreferences.getPrefs().getBoolean("full", false))
works fine because this is used else where in the activity to display other information if the user does have the full key.
So the question is why goes the above not work for the adView?
I have never used airpush but why don't you just not run the ad code if the user has a key.
There is no point setting up all of the listeners and the new AirPlay object if the ads are not to be displayed.
e.g: