0

I wish to remove the ad if they are clicked once. I implemented the following code. I also added android:launchMode="singleInstance" in the manifest and android:alwaysRetainTaskState="true" in the activity section of the manifest.

But when i click on the ad and return to the app the ad is still showing . My code is as follows.

public class MainActivity extends Activity implements AdListener{
 adView = (AdView)findViewById(R.id.ad);

       adView.loadAd(new AdRequest());
 // my code

  @Override
public void onDismissScreen(Ad arg0) {
    if (adView != null) {
        adView.destroy();
      }
    // TODO Auto-generated method stub

}



@Override
public void onFailedToReceiveAd(Ad arg0, ErrorCode arg1) {
    // TODO Auto-generated method stub

}



@Override
public void onLeaveApplication(Ad arg0) {
    // TODO Auto-generated method stub

}



@Override
public void onPresentScreen(Ad arg0) {
    // TODO Auto-generated method stub

}



@Override
public void onReceiveAd(Ad arg0) {
    // TODO Auto-generated method stub

}


     }
4

1 に答える 1

1
adView.setAdListener(this); /* first you should add listener register */

and for dismiss screen


public void onDismissScreen(Ad p1)
{
    yourlayout.removeView(adView); // your layout should me remove here
}
于 2013-03-27T15:52:17.987 に答える