Ich habe eine Menge Schwierigkeiten, die Interstitial zu zeigen, es ist meine erste Arbeit mit dem Cocos2D-Spiel. Das ist alles Haupt-Java-CodeInterstitial-Anzeigen für Coco2D Android-Spiel
public class FlyingPanda extends Activity implements AdListener {
/** Called when the activity is first created. */
public static CCGLSurfaceView mGLSurfaceView;
private boolean isCreated = false;
private static final String ADMOB_PUBLISH_ID = "xxxxxxxxxxxxxxxxxx";
@Override
public void onCreate(Bundle savedInstanceState) {
if(!isCreated){
isCreated = true;
} else {
return;
}
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
RelativeLayout layout = new RelativeLayout(this);
layout.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
mGLSurfaceView = new CCGLSurfaceView(this);
// Create the adView
AdView adView = new AdView(this, AdSize.BANNER, ADMOB_PUBLISH_ID);
// Initiate a generic request to load it with an ad
adView.loadAd(new AdRequest());
adView.setAdListener(this);
// Add the adView to it
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
params.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
adView.setLayoutParams(params);
layout.addView(mGLSurfaceView);
layout.addView(adView);
setContentView(layout);
Common.game_initialize();
getScaledCoordinate();
CCDirector.sharedDirector().attachInView(mGLSurfaceView);
// attach the OpenGL view to a window
Common.sound_engine = SoundEngine.sharedEngine();
loadSound();
Was soll ich hier in admob Einstellung hinzufügen? Ich definiere eine Variable namens Interstitial wie das Banner oder was?
////////////////////////////////////////////////////////////////////////////////
// Admob Setting
////////////////////////////////////////////////////////////////////////////////
Wie kann ich Interstitial in all diesen öffentlichen Klassen laden?
@Override
public void onDismissScreen(Ad ad) {
// TODO Auto-generated method stub
}
@Override
public void onFailedToReceiveAd(Ad ad, ErrorCode errorCode) {
// TODO Auto-generated method stub
}
@Override
public void onLeaveApplication(Ad ad) {
// TODO Auto-generated method stub
}
@Override
public void onPresentScreen(Ad ad) {
// TODO Auto-generated method stub
}
@Override
public void onReceiveAd(Ad ad) {
Eclipse oder Android Studio? Fügen Sie nur das erforderliche Tag hinzu, cocos2d mit vielen Verzweigungen. Machen Sie also klar, in welches Framework Sie integrieren möchten. – Aryan