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
- Host: GitHub
- URL: https://github.com/iammert/rewarded-ads-sample
- Owner: iammert
- Created: 2017-06-03T22:31:05.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-03T22:49:18.000Z (over 8 years ago)
- Last Synced: 2024-03-03T00:32:43.050Z (over 1 year ago)
- Topics: addon, admob, ads, chartboost, rewarded, startapp
- Language: Java
- Size: 445 KB
- Stars: 17
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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]
```