AdMob is a service for developers that provides advertisements for your apps. If you’ve used Android for any amount of time, I’m sure you know that many apps are monetized through small ads displayed in the app. So the question is, how can you get your own piece of the mobile ad pie? Well, I’m about to tell you.
import android.content.Context;
import android.widget.LinearLayout;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;
import com.mcc.fdc.R;
public class GooglePlayAdmob {
private AdView adView;
public GooglePlayAdmob(Context context, LinearLayout linearLayout) {
adView = new AdView(context);
adView.setAdSize(AdSize.SMART_BANNER);
adView.setAdUnitId(context,”a152dcf32aa86ce”);
linearLayout.addView(adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
}
}