1

I have already implemented admob Reward ads and want to show native ads. Really didn't get any useful source and stuck in this problem for 3 days. Can any one help me to show native ads please its an emergency issue.

I have tried appodeal also but got so many errors nothing else.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115

2 Answers2

0

Add this to your XML

<com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:id="@+id/adView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    ads:adSize="SMART_BANNER"
    ads:adUnitId="YOUR UNIT ID" />

And this is how you can request for Ads

private AdView mAdView;

MobileAds.initialize(this, "Ads Key This is Different from UNIT ID");

mAdView = findViewById(R.id.adView);

AdRequest adRequest = new AdRequest.Builder().build();

mAdView.loadAd(adRequest);

mAdView.setAdListener(new AdListener() {
        @Override
        public void onAdLoaded() {
            Log.e("Add Listener", "AdLoaded");
        }

        @Override
        public void onAdFailedToLoad(int errorCode) {
            Log.e("Add Listener", "onAdFailedToLoad" + " - " + errorCode);
        }

        @Override
        public void onAdOpened() {
            Log.e("Add Listener", "AdOpened");
        }

        @Override
        public void onAdLeftApplication() {
            Log.e("Add Listener", "AdLeft");
        }

        @Override
        public void onAdClosed() {
            Log.e("Add Listener", "AdClosed");
        }
    });
Kanwarpreet Singh
  • 2,037
  • 1
  • 13
  • 28
0

what i have done for my app was implementing an imageview on top of all layouts as a framelayout. the idea was using glide and a link that goes into the app. so what you need is two things

1) a redirect link that goes to a php file on your server and update the destination link (this way you can count clicks on the add)

2) an imageview in your app that loads the image from your server and has in contains that redirect link in it's onclick method.

Community
  • 1
  • 1
Namini40
  • 100
  • 7