React-native-admob: What's prop name for AdMob App ID?

Created on 24 May 2017  路  8Comments  路  Source: sbugert/react-native-admob

When I created a new AdMob app, I got an App ID and Ad unit ID for every ad unit. But I don't see where to assign App ID, for example, with AdMobBanner there is only adUnitID prop.

Thanks,

Most helpful comment

For other who find answer:
iOS: AppDelegate.m (excerpt) @import GoogleMobileAds; and add:
[GADMobileAds configureWithApplicationID:@"YOUR_ADMOB_APP_ID"];

Android: MainActivity.java add import com.google.android.gms.ads.MobileAds and
MobileAds.initialize(this, "YOUR_ADMOB_APP_ID");

All 8 comments

I know how to do it now :)

For other who find answer:
iOS: AppDelegate.m (excerpt) @import GoogleMobileAds; and add:
[GADMobileAds configureWithApplicationID:@"YOUR_ADMOB_APP_ID"];

Android: MainActivity.java add import com.google.android.gms.ads.MobileAds and
MobileAds.initialize(this, "YOUR_ADMOB_APP_ID");

Can write how you did it ?

I tried what @Dictory said but I get errors in Android Studio.

Can you maybe provide a sample of how the full code in MainActivity.java ?

Thank you !

@Kris4an7

package ...
import ...
import android.os.Bundle;
import com.google.android.gms.ads.MobileAds;

public class MainActivity extends AppCompatActivity {
    ...
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        // Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713
        MobileAds.initialize(this, "YOUR_ADMOB_APP_ID");
    }
    ...
}

from quick start

@Tiendq @Dictory Out of curiosity, what is the point of assigning the AdMob App ID if ads seem to work fine with just the adUnitId? Do I miss out on anything? I didn't know about AdMob App ID.

@booboothefool Well, none from my experience.
I thought I need it, hence the question, but it turned out to work fine without it.

Thanks for the answer @Dictory !

@booboothefool it's for reporting, you could have several ad units in an app.

When I try @Dictory's method, my app "keeps stopping"

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xvlm picture xvlm  路  5Comments

furkancelik picture furkancelik  路  5Comments

talaikis picture talaikis  路  3Comments

giladno picture giladno  路  6Comments

vu-dang picture vu-dang  路  5Comments