The PEP Ads SDK lets your app show ads and earn from the PEP economy. You choose where each ad appears; the SDK handles fetching the ad, showing it, and reporting when it is seen or tapped. v0.1.0 Android
How you earn — read this first
You never handle money in your app. Here is the whole loop:
- Your app asks the SDK to show an ad in one of your placements.
- The SDK fetches an ad from the PEP ad network and shows it.
- When the ad is actually seen (or tapped), the SDK reports it back — you write no tracking code.
- The PEP economy values that verified delivery and credits your developer wallet on a revenue split.
- You watch your balance grow on the PEP Wallet page.
Where to get your app key and secret
Every framework below starts by calling PepAds.init() with two values, and both come from one place in this console:
- Open My Apps in the sidebar.
- In your app's Actions column, click Secrets.
- Click Enable Ads. This registers the app with the ad network and issues its credentials.
The panel then shows your app key, your app secret (hidden until you click the eye) and your placement ids, each with a copy button. Reopen Secrets any time to read them again — you do not get one chance at them.
Choose your framework
Pick the technology your app is built with. The steps are written to be followed top to bottom, even if this is your first time adding an SDK.
Android · Kotlin
Before you start: you need Android Studio, an app with minSdk 24 or higher, and a placement id from PEP.
-
Add the SDK to your project
Tell Gradle where to find the SDK, then add it as a dependency. In
settings.gradle.kts, insidedependencyResolutionManagement { repositories { … } }:settings.gradle.ktsmaven { url = uri("https://pepecosystem-com.b-cdn.net/sdk/maven") }Then in your app module's
build.gradle.kts, insidedependencies { … }:app/build.gradle.ktsimplementation("com.pepecosystem:pepads:0.1.1")Click Sync Now in Android Studio. The SDK needs no other libraries and adds only the internet permission.
-
Start the SDK once
Call
PepAds.init()when your app starts, passing your app key and app secret. You get both from My Apps → Secrets → Enable Ads, as described above. The best place to call it is yourApplicationclass (create one if you don't have it and register it in your manifest withandroid:name).MyApp.ktclass MyApp : Application() { override fun onCreate() { super.onCreate() PepAds.init(appKey = YOUR_APP_KEY, appSecret = YOUR_APP_SECRET) // If you know the signed-in PEP user, tell the SDK — it helps // the network apply fair per-user limits. Optional. PepAds.setIdentity(currentPepUserId) } }Keep the app secret out of source control and off any screen — store it the way you would any API secret (for example, in your app's BuildConfig from a local, untracked properties file).
-
Show a banner where you want it
A
BannerAdViewis a normal Android view. Put it anywhere in your layout — the ad renders at its natural shape inside the width you give it, so a wide leaderboard looks like a leaderboard and a box ad looks like a box.Kotlinval banner = BannerAdView(context) yourLayout.addView(banner) // wherever it belongs in your screen banner.loadAd(placementId = YOUR_BANNER_PLACEMENT, listener = object : AdLoadListener { override fun onAdLoaded(ad: Ad) { // The ad is showing. Nothing else to do — the impression is // reported for you once it has been on screen long enough. } override fun onNoFill() { // No ad was available right now. This is normal — just hide the slot. banner.visibility = View.GONE } override fun onError(error: AdError) { Log.w("PepAds", "Banner failed: " + error.message) } })A tap on the banner is tracked and opens the advertiser's link automatically. You write none of that.
-
Show a rewarded ad
A rewarded ad is full-screen and the user watches it to the end. Load it first, then show it when the user chooses to (for example, taps a "Watch to earn" button).
Kotlinval rewarded = RewardedAd(placementId = YOUR_REWARDED_PLACEMENT) rewarded.load(object : AdLoadListener { override fun onAdLoaded(ad: Ad) { // Loaded and ready. Show it (you need the current Activity). rewarded.show(activity, object : RewardedAdListener { override fun onRewardEarned(trackingToken: String) { // The user finished watching the ad. } override fun onDismissed(completed: Boolean) { // The dialog closed. `completed` is true if it was watched to the end. } override fun onError(error: AdError) { } }) } override fun onNoFill() { // No rewarded ad available right now — tell the user to try later. } override fun onError(error: AdError) { } })
Java note
Every class here works from Java too, unchanged — see the Android · Java tab for the same steps in Java syntax.
Troubleshooting
- Always "no fill"? Check your placement id is correct and active, and that ads are running for your app.
- Testing against a local server? Android blocks plain
http://by default. Addandroid:usesCleartextTraffic="true"to your debug manifest, and pass the base URL as the third argument:PepAds.init(YOUR_APP_KEY, YOUR_APP_SECRET, "http://10.0.2.2:PORT")(the emulator's address for your computer). Never ship cleartext in a release build.
Android · Java
Before you start: Android Studio, an app with minSdk 24 or higher, and a placement id from PEP. The SDK is the same artifact as Kotlin — it is built to read naturally from Java.
-
Add the SDK to your project
In
settings.gradle, insidedependencyResolutionManagement { repositories { … } }:settings.gradlemaven { url 'https://pepecosystem-com.b-cdn.net/sdk/maven' }Then in your app module's
build.gradle, insidedependencies { … }:app/build.gradleimplementation 'com.pepecosystem:pepads:0.1.1'
Click Sync Now.
-
Start the SDK once
MyApp.javapublic class MyApp extends Application { @Override public void onCreate() { super.onCreate(); // Key and secret: My Apps -> Secrets -> Enable Ads. PepAds.init(YOUR_APP_KEY, YOUR_APP_SECRET); PepAds.setIdentity(currentPepUserId); // optional } } -
Show a banner
JavaBannerAdView banner = new BannerAdView(context); yourLayout.addView(banner); banner.loadAd(YOUR_BANNER_PLACEMENT, new AdLoadListener() { @Override public void onAdLoaded(Ad ad) { } @Override public void onNoFill() { banner.setVisibility(View.GONE); } @Override public void onError(AdError error) { Log.w("PepAds", "Banner failed: " + error.message); } }); -
Show a rewarded ad
JavaRewardedAd rewarded = new RewardedAd(YOUR_REWARDED_PLACEMENT); rewarded.load(new AdLoadListener() { @Override public void onAdLoaded(Ad ad) { rewarded.show(activity, new RewardedAdListener() { @Override public void onRewardEarned(String trackingToken) { // The user finished watching the ad. } @Override public void onDismissed(boolean completed) { } @Override public void onError(AdError error) { } }); } @Override public void onNoFill() { } @Override public void onError(AdError error) { } });
Troubleshooting
- Always "no fill"? Confirm the placement id is correct and active.
- Local server testing? Add
android:usesCleartextTraffic="true"to your debug manifest and callPepAds.init(YOUR_APP_KEY, YOUR_APP_SECRET, "http://10.0.2.2:PORT").
React Native
Before you start: a React Native app (0.71+), and a placement id from PEP. The package is Android only today — on iOS the components render nothing, so your app still runs but shows no ads there.
-
Install the package
terminalnpm install https://pepecosystem-com.b-cdn.net/sdk/npm/pepecosystem-pepads-0.1.1.tgz
React Native links the native code automatically. You do not need to edit any Java or Kotlin.
-
Point Android at the SDK
The package uses a small native library that lives on the PEP CDN. Tell Android where to find it: open
android/build.gradleand add the repository underallprojects { repositories { … } }:android/build.gradlemaven { url 'https://pepecosystem-com.b-cdn.net/sdk/maven' }Rebuild the Android app once (
npx react-native run-android) so the native part is picked up. -
Start the SDK once
Call
PepAds.init()as your app boots — for example, in a top-leveluseEffectin yourAppcomponent. Pass the app key and app secret from My Apps → Secrets → Enable Ads. Keep the secret out of your JS bundle where you can — read it from a native config or your build's environment rather than hard-coding it.App.jsimport { useEffect } from 'react'; import PepAds from '@pepecosystem/pepads'; export default function App() { useEffect(() => { PepAds.init(YOUR_APP_KEY, YOUR_APP_SECRET); PepAds.setIdentity(currentPepUserId); // optional }, []); // …your app… }Testing against a local server? Pass the base URL as the third argument:
PepAds.init(YOUR_APP_KEY, YOUR_APP_SECRET, 'http://10.0.2.2:PORT'). -
Show a banner
PepAdsBanneris a normal React Native component. Drop it into your layout and give it a height; the ad fills the width and keeps its own shape.JSXimport { PepAdsBanner } from '@pepecosystem/pepads'; function HomeScreen() { return ( <View> <Text>Your content</Text> <PepAdsBanner placementId={YOUR_BANNER_PLACEMENT} style={{ height: 90, width: '100%' }} /> <Text>More content</Text> </View> ); }The impression and any tap are tracked for you — no callbacks needed for a basic banner.
-
Show a rewarded ad
Rewarded ads use promises. Load one, then show it when the user asks.
showRewardedresolves once the user has watched it to the end.JavaScriptimport PepAds from '@pepecosystem/pepads'; async function watchToEarn() { try { const ad = await PepAds.loadRewarded(YOUR_REWARDED_PLACEMENT); if (!ad) { // null means no ad was available right now. return; } await PepAds.showRewarded(YOUR_REWARDED_PLACEMENT); // The user finished watching the ad. } catch (e) { console.warn('Rewarded failed:', e.message); } }If you also want to know when the ad dialog closes:
JavaScriptconst sub = PepAds.onRewardedDismissed(({ completed }) => { console.log('closed, watched to end:', completed); }); // later, when you no longer need it: sub.remove();
Troubleshooting
- Build fails after install? Make sure you added the maven line in step 2 and did a full
run-androidrebuild (Metro reload alone is not enough for native changes). - Banner is invisible? Give it a real height in its
style— without one there is no space to draw into. - Nothing on iOS? Expected — the package is Android only for now.
Flutter
Before you start: a Flutter app on Flutter 3.10 or newer, with Android minSdk 24 or higher (check android/app/build.gradle), and a placement id from PEP. The plugin is Android only today — on iOS every call does nothing and the widgets render nothing, so your app still runs.
-
Add the plugin
In
pubspec.yaml, underdependencies::pubspec.yamldependencies: pepads: ^0.1.0
Run
flutter pub get. -
Point Android at the SDK
The plugin uses a native library on the PEP CDN. Open
android/build.gradleand add the repository underallprojects { repositories { … } }:android/build.gradlemaven { url 'https://pepecosystem-com.b-cdn.net/sdk/maven' }Then rebuild once with
flutter run. -
Start the SDK once
Call
PepAds.init()as your app starts, for example inmain(). Pass the app key and app secret from My Apps → Secrets → Enable Ads. Read the secret from your build config (for example--dart-define) rather than committing it.main.dartimport 'package:flutter/material.dart'; import 'package:pepads/pepads.dart'; Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); await PepAds.init(appKey: YOUR_APP_KEY, appSecret: YOUR_APP_SECRET); await PepAds.setIdentity(currentPepUserId); // optional runApp(const MyApp()); }Testing against a local server? Add the base URL:
PepAds.init(appKey: YOUR_APP_KEY, appSecret: YOUR_APP_SECRET, baseUrl: 'http://10.0.2.2:PORT'). -
Show a banner
PepAdsBanneris a widget. Place it in your layout and give it a height (wrap it in aSizedBox); the ad fills the width and keeps its shape.DartColumn( children: [ const Text('Your content'), const SizedBox( height: 90, child: PepAdsBanner(placementId: YOUR_BANNER_PLACEMENT), ), const Text('More content'), ], )The impression and any tap are tracked for you.
-
Show a rewarded ad
Rewarded ads use futures. Load one, then show it when the user asks;
showRewardedcompletes once the ad has been watched to the end.DartFuture<void> watchToEarn() async { try { final ad = await PepAds.loadRewarded(YOUR_REWARDED_PLACEMENT); if (ad == null) { // No ad available right now. return; } await PepAds.showRewarded(YOUR_REWARDED_PLACEMENT); // The user finished watching the ad. } catch (e) { debugPrint('Rewarded failed: $e'); } }To know when the ad closes, listen to the stream:
Dartfinal sub = PepAds.onRewardedDismissed.listen((event) { debugPrint('closed, watched to end: ${event.completed}'); }); // later: sub.cancel();
Troubleshooting
- Build fails? Confirm the maven line in step 2 and do a full
flutter run(hot reload does not rebuild native code). - Banner not visible? Wrap it in a
SizedBoxwith a height — a widget with no height has nowhere to draw. - Nothing on iOS? Expected — the plugin is Android only for now.
PEP Dev Portal