Step3 - Adding styles
If you have styles.xml inside res/values folder, copy there lines inside:
<style name="Presage.Theme.Transparent" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
Else, create styles.xml inside res/values folder with there lines inside:
<resources>
<style name="Presage.Theme.Transparent" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
</resources>
Step 4 - Editing Your Main File
Add the following import
import io.presage.Presage;
Inside your activity in onCreate, please add:
Presage.getInstance().setContext(this.getBaseContext());
Presage.getInstance().start();
Step 5 - Enabling Interstitial
Import the following
import io.presage.utils.IADHandler;
Ad these lines in your activity:
@Override
protected void onResume() {
super.onResume();
Presage.getInstance().adToServe("interstitial", new IADHandler() {
@Override
public void onAdNotFound() {
Log.i("PRESAGE", "ad not found");
}
@Override
public void onAdFound() {
Log.i("PRESAGE", "ad found");
}
@Override
public void onAdClosed() {
Log.i("PRESAGE", "ad closed");
}
});
}
Step 6 (optional) - "Backfill" with other ads
To maximize your revenues, you can choose to backfill our SDK when we have no ads to show with the ads from an other network.
To do this, just make the call to an other interstitial when the onAdNotFound event is triggered.
@Override
protected void onResume() {
super.onResume();
Presage.getInstance().adToServe("interstitial", new IADHandler() {
@Override
public void onAdNotFound() {
// Here, just put the code you need in order to display an ad from an other network.
}
@Override
public void onAdFound() {
Log.i("PRESAGE", "ad found");
}
@Override
public void onAdClosed() {
Log.i("PRESAGE", "ad closed");
}
});
}