Answers for "how to add admob ads in android app"

0

init admob

package ...
import ...
import com.google.android.gms.ads.MobileAds;
import com.google.android.gms.ads.initialization.InitializationStatus;
import com.google.android.gms.ads.initialization.OnInitializationCompleteListener;

public class MainActivity extends AppCompatActivity {

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        MobileAds.initialize(this, new OnInitializationCompleteListener() {
            @Override
            public void onInitializationComplete(InitializationStatus initializationStatus) {
            }
        });
    }
}
Posted by: Guest on January-11-2020
2

how to add admob ads in android app

dependencies {
  implementation 'com.google.android.gms:play-services-ads:20.4.0'
}

<manifest>
    <application>
        <!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
    </application>
</manifest>

 MobileAds.initialize(this) {}
 
 add banner add and other ads
 https://developers.google.com/admob/android/quick-start#kotlin
Posted by: Guest on November-02-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language