An open API service indexing awesome lists of open source software.

https://github.com/iammert/rewarded-ads-sample

Sample project to show rewarded ads on your android app
https://github.com/iammert/rewarded-ads-sample

addon admob ads chartboost rewarded startapp

Last synced: 7 months ago
JSON representation

Sample project to show rewarded ads on your android app

Awesome Lists containing this project

README

          

# rewarded-ads-sample
Sample project to show rewarded ads on your android app

# Usage

```java
public class MainActivity extends AppCompatActivity implements RewardedVideoListener{

@Override
protected void onCreate(Bundle savedInstanceState) {
...
RewardedAd rewardedAd = RewardedAdFactory.getRewardedAd(this, AdType.ADMOB, this);
rewardedAd.showAd();
...
}

@Override
public void onVideoCompleted() {
Log.v("TEST", "Video completed.");
}

@Override
public void onVideoLoadFailed() {
Log.v("TEST", "Video failed.");
}

@Override
public void onVideoStarted() {
Log.v("TEST", "Video started.");
}
}
```

3 ad network types are supported. PR's are welcome for other ad networks.
``` java
AdType.ADMOB
AdType.CHARTBOOST
AdType.STARTAPP
```

# Handling Lifecycle
LifeCycleRegistry is used to handle lifecycle in Ad instances.
```java
LifecycleRegistry lifecycleRegistry = new LifecycleRegistry(this);
lifecycleRegistry.addObserver(rewardedAd.getObserver());
```

# Replace Keys
```xml

[REPLACE_CHARTBOOST_APP_ID]
[REPLACE_CHARTBOOST_APP_SIGNATURE]


[REPLACE_ADMOB_AD_UNIT_ID]


[REPLACE_STARTAPP_APP_ID]
```