package com.ads.interads;
import com.google.appinventor.components.annotations.*;
import com.google.appinventor.components.runtime.*;
import com.google.appinventor.components.common.*;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.InterstitialAd;
@DesignerComponent(version = 1, // Update version here, You must do for each new release to upgrade your extension
description = "interads",
category = ComponentCategory.EXTENSION,
nonVisible = true,
iconName = "images/extension.png") // Change your extension's icon from here; can be a direct url
@SimpleObject(external = true)
public class InterstitialAdsActivity extends AppCompatActivity {
InterstitialAd mInterstitialAd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_interstitial_ads);
mInterstitialAd = new InterstitialAd(this);
// set the ad unit ID
mInterstitialAd.setAdUnitId(getString);
AdRequest adRequest = new AdRequest.Builder().build();
// Load ads into Interstitial Ads
mInterstitialAd.loadAd(adRequest);
mInterstitialAd.setAdListener(new AdListener() {
public void onAdLoaded() {
showInterstitial();
}
});
}
@Override
private void showInterstitial() {
if (mInterstitialAd.isLoaded()) {
mInterstitialAd.show();
}
}
}
There are a number of things wrong with your code. You may want to start by following the example in the extensions document first to understand how to build a simple extension before tackling one with lots of extra constraints.
Extensions must be a subclass of AndroidNonvisibleComponent
AAR support is not available for extensions, so your references to R.layout will all fail to compile
I have no idea where getString is coming from, so my guess is you'll get a compiler error on that token as well
You’ve been given help in post #2. You are refusing to do anything yourself. At this point you are now spamming by asking for help over and over again.
I don't know. As the others have stated, you may want to start simple first and learn how to build a component and an extension for App Inventor before getting too complicated. As I mentioned in my earlier statements, you likely aren't going to be able to make this work due to issue #2.