Skip to content

Android Tam Ekran Reklam Entegrasyonu

magirtopcu edited this page Apr 19, 2016 · 8 revisions

###1) Gradle dosyanıza Rekmob bağımlılıklarını ekleyiniz.

repositories{
    maven{
        url "http://dl.bintray.com/rekmob/android-sdk"
      }
    }
dependencies {
    compile 'com.rekmob:android-sdk:3.3.0@aar'
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.google.android.gms:play-services-ads:8.4.0'
} 

2) AndroidManifest.xml dosyanıza gerekli izinleri ve activity'leri ekleyiniz.

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<activity android:name="com.rekmob.ads.RekmobActivity" android:configChanges="keyboardHidden|orientation" />
<activity android:name="com.rekmob.ads.MraidActivity" android:configChanges="keyboardHidden|orientation" />
<activity android:name="com.rekmob.common.RekmobBrowser" android:configChanges="keyboardHidden|orientation" />

<!-- Google Play Service --> 
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> 
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

3) Activity dosyanıza gerekli kodları ekleyiniz.

Genel konfigurasyon aşağıdaki gibidir. onDestroy methodunda reklamı destroy etmeyi unutmayınız!


public class ExampleActivity extends Activity {
    RekmobInterstitial rekmobInterstitial;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        rekmobInterstitial = new RekmobInterstitial(this, REKMOB_AD_UNIT_ID_HERE); 
        rekmobInterstitial.setInterstitialAdListener(new RekmobInterstitial.InterstitialAdListener() {
            @Override
            public void onInterstitialLoaded(RekmobInterstitial interstitial) {
                    if(interstitial.isReady()){
                        interstitial.show();
                    }
            }

            @Override
            public void onInterstitialFailed(RekmobInterstitial interstitial, RekmobErrorCode errorCode) {

            }

            @Override
            public void onInterstitialShown(RekmobInterstitial interstitial) {

            }

            @Override
            public void onInterstitialClicked(RekmobInterstitial interstitial) {

            }

            @Override
            public void onInterstitialDismissed(RekmobInterstitial interstitial) {

            }
        });
       rekmobInterstitial.load();
    }

    @Override
    protected void onDestroy() {
        if(rekmobInterstitial!=null){
        	rekmobInterstitial.destroy();
        }
        super.onDestroy();
    }

 
}