Search code examples
androidadmob

How to apply Admob code with real App id and unit id..?


I'm very new to Android and I want to launch my first application but I'm facing problem while I'm trying to apply AdMob code in my application.

When I check my code with test ad id it is working fine but when I'm using the same code with my real AdMob App id and Unit id this give me no add in my frame and the Logcat is showing me this.

19 5029-5216/com.example.aviralchauhan.demoplayer E/FA: GoogleService failed 
to initialize, status: 10, Missing google app id value from from string 
resources with name google_app_id.
2019-07-23 12:14:10.330 5029-5216/com.example.aviralchauhan.demoplayer E/FA: 
Missing google_app_id. Firebase Analytics disabled    2019-07-23 12:14:10.336 5029-5216/com.example.aviralchauhan.demoplayer E/FA: 
Uploading is not possible. App measurement disabled

As you suggested that this is duplicate question so can you please explain that it's really important to connect the application with firebase to show to ads in my application as I already told you test ads are working fine.


Solution

  • No, it is not really necessary to integrate Firebase with Google but it is recommended so as to get detailed statics over how the user acts over your app and their interaction with the app.

    Now, the main topic: Why the add code is not working?
    I am sure that you have something like this in your manifest.xml file:

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

    There, the text YOUR_ADMOB_APP_ID must be replaced by a real ID which you will get by adding your app to the AdMob dashboard. Check this to get the real ID.