C
C
Chesterfield252021-11-25 11:23:53
Java
Chesterfield25, 2021-11-25 11:23:53

Why aren't ads showing up in the app?

There is an application that shows ads from admob. The application is approved in the play market. In the advertising account, the application is associated with the play market. Test ads are displayed without problems. At the moment, a little more than a day after approval in the play store.

One of my activities that hosts ads.

public class PolicyActivity extends AppCompatActivity {

    private ActivityPolicyBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityPolicyBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());

        //adsense ads code
        MobileAds.initialize(this, new OnInitializationCompleteListener() {
            @Override
            public void onInitializationComplete(InitializationStatus initializationStatus) {
            }
        });

        AdRequest adRequest = new AdRequest.Builder().build();
        binding.adView.loadAd(adRequest);
        binding.adViewTwo.loadAd(adRequest);

        binding.webView.getSettings().setJavaScriptEnabled(true);
        binding.webView.getSettings().setDomStorageEnabled(true);
        binding.webView.setWebChromeClient(new WebChromeClient());
        binding.webView.loadUrl("file:///android_asset/www/index.html");
    }

    public void back(View view) {

        startActivity(new Intent(this, MainActivity.class));
        finish();

    }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question