AdMob ads really do not appear

-2

the ads do not appear to me, if I put a test id, yes.

Is it true that for the real ads to appear first the app must be uploaded to the PlayStore ??

Test ads work, but not really. The ids I put them with XXX to not show them but they are the ones given to me by Firebase Admob.

            apply plugin: 'com.android.application'

            android {

            compileSdkVersion 28
            defaultConfig {
             applicationId "com.redlogames.gamestraductionsnative"
            minSdkVersion 19
            targetSdkVersion 28
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner 
            "android.support.test.runner.AndroidJUnitRunner"
           }
           buildTypes {
            release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- 
    rules.pro'
    }
   }
  }
  configurations.all {
   resolutionStrategy.eachDependency { DependencyResolveDetails details ->
    def requested = details.requested
    if (requested.group == 'com.android.support') {
        if (!requested.name.startsWith("multidex")) {
            details.useVersion '27.1.1'
        }
    }
   }
 }

dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])

     implementation 'com.android.support:appcompat-v7:28.0.0'

    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
     testImplementation 'junit:junit:4.12'

     implementation 'com.google.android.gms:play-services-ads:17.1.2'
    implementation 'com.google.firebase:firebase-ads:17.1.2'

    implementation 'com.google.firebase:firebase-core:16.0.6'

   }
   apply plugin: 'com.google.gms.google-services'
Builde Gradle project buildscript {

    repositories {
       google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'
    classpath 'com.google.gms:google-services:4.2.0' // google-services plugin


    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
   }
}

allprojects {
   repositories {
       maven {
           url "https://maven.google.com"
       }
      jcenter()

 }
}

task clean(type: Delete) {
  delete rootProject.buildDir
}

Manifest xml

    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

    <meta-data
        android:name="com.google.android.gms.ads.AD_MANAGER_APP"
        android:value="true"/>

    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity android:name=".ConexionActivity"></activity>
   </application>

  </manifest>

my activity xml

   <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        ads:adSize="BANNER"
        ads:adUnitId="@string/banner_ad_unit_id">
    </com.google.android.gms.ads.AdView>
String xml

  <resources>
     <string name="banner_ad_unit_id">ca-app-pub-839674458XXXXXX</string>
  </resources>

Java Activity Code (Abbreviated)

public class ConexionActivity extends Activity {

  private InterstitialAd mInterstitialAd;
  private PublisherInterstitialAd mPublisherInterstitialAd;
  private AdView mAdView;
  private FirebaseAnalytics mFirebaseAnalytics;
  private static final String TAG = "ConexionActivity";


  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_conexion);
    Bundle bundle = getIntent().getExtras();
    port = (bundle.getInt("port"));


    //ANALYTICS FIREBASE
    mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
    //ANALITIC FIREBASE FIN

    //ANUNCIOS
    //Cargamos ADMOB al arrancar la app
    mPublisherInterstitialAd = new PublisherInterstitialAd(this);
    mPublisherInterstitialAd.setAdUnitId("ca-app-pub-8396744_MI_ID_XXXX");
    mPublisherInterstitialAd.loadAd(new PublisherAdRequest.Builder().build());

    //ca-app-pub-3940256099942544/8691691433 Id Anuncio de mentira
    mInterstitialAd = new InterstitialAd(this);
    mInterstitialAd.setAdUnitId("ca-app-pub-839674_MI_ID_XXXXX");

    //Anuncio Banner
    mAdView = new AdView(this);
    mAdView.setAdSize(AdSize.BANNER);
    mAdView.setAdUnitId("ca-app-pub-839674458730_MI_ID_XXXXXX");

    @Override
   public void onResume() {
    super.onResume();
    Log.d("message", "estoy activo ");
    //CARGO ANUNCIO******************
    //mInterstitialAd.loadAd(new AdRequest.Builder().build());
    AdRequest adRequest = new AdRequest.Builder().build();
    mInterstitialAd.loadAd(adRequest);
    if (mPublisherInterstitialAd.isLoaded()) {
        entrar = false;
        mPublisherInterstitialAd.show();

    } else {
        entrar = true;
        Log.d("TAG", "The interstitial wasn't loaded yet.");
    
asked by Killik 26.12.2018 в 19:58
source

0 answers