All docs
iOS and Android SDK quick start
Initialize the Worksly SDK on iOS, Android and Unity, load a rewarded ad, and go from install to first live impression.
This page takes a native app from zero to a live rewarded ad in a few minutes: install the SDK, initialize with your app ID, and load your first placement. The same pattern covers interstitial and banner placements. Wrappers for React Native, Flutter and Unity share the native SDKs underneath; a Unity example is included below.
Before you start
- Register your app in the Worksly dashboard under Settings → Inventory. Each app gets an app ID, and each ad slot in the app gets a placement ID. The exact IDs are in your dashboard. The values below are placeholders.
- Note the minimum OS versions the SDK supports: iOS 14+ and Android API 21+.
- Decide your first placement type. Rewarded is the usual starting point because it is user-initiated and clears at the highest eCPM.
iOS (Swift)
Install the SDK with Swift Package Manager by adding the package URL shown in your dashboard under Settings → Apps (or with CocoaPods, using the pod name from the same screen).
Import, initialize, and load a rewarded ad:
import WorkslySDK
import UIKit
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
Worksly.initialize(appId: "YOUR_APP_ID")
return true
}
func showRewardedAd(from viewController: UIViewController) {
Worksly.loadRewarded(placementId: "YOUR_PLACEMENT_ID", from: viewController) { ad, error in
guard let ad = ad else {
// Log the error and fall back to your no-ad path
return
}
ad.present()
}
}
Call showRewardedAd from the moment where the user has opted in, a “watch to unlock” button, for example. The completion handler receives either a loaded ad or an error; always keep a graceful no-ad path, because fill is never 100%.
Android (Kotlin)
Add the dependency to your module’s build.gradle:
dependencies {
implementation("com.worksly:sdk:2.+")
}
Initialize in your Application class and load rewarded at the moment you need it:
import com.worksly.sdk.Worksly
import com.worksly.sdk.RewardedAd
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
Worksly.initialize(context = this, appId = "YOUR_APP_ID")
}
}
fun showRewardedAd(activity: Activity, onReward: () -> Unit) {
Worksly.loadRewarded(activity, "YOUR_PLACEMENT_ID", object : RewardedAd.Listener {
override fun onLoaded(ad: RewardedAd) {
ad.show(activity, onRewarded = onReward, onDismissed = { })
}
override fun onFailed(reason: String) {
// Keep your no-ad path working; retry on the next user action
}
})
}
The onRewarded callback fires only when the ad qualifies for reward, so grant the benefit in that callback.
Unity (C#)
For games built in Unity, install the Worksly Unity package and use the wrapper API:
using Worksly.SDK;
void Start()
{
Worksly.Initialize("YOUR_APP_ID");
}
public void ShowRewarded()
{
Worksly.LoadRewarded("YOUR_PLACEMENT_ID", ad => {
if (ad != null) {
ad.Show(
onRewarded: () => GrantBonus(),
onDismissed: () => { }
);
} else {
// No fill: fall back to your no-ad path
}
});
}
Test mode
All three SDKs ship in test mode by default: test requests return test creatives and impressions are flagged as invalid, so they appear in traffic but never in monetization reports. Initialize with test mode explicitly disabled only after your placements verify correctly. The dashboard shows test traffic under Settings → Inventory → Diagnostics. Release builds submitted to the stores must have test mode off; a release build left in test mode earns nothing and looks like a bug when it is a flag.
Consent
If you serve users in the EEA or UK, the SDK must receive a valid consent signal before it requests ads. The SDK reads the TCF 2.2 consent string from your integrated consent management platform automatically on mobile, and you can pass Consent Mode signals explicitly. See the consent page in this documentation for the details. Integrate a CMP before you ship to those regions.
Going live checklist
- Confirm your app-ads.txt is published (see the ads.txt page) and that the developer domain in your store listing matches where it is hosted.
- Verify placement-level traffic in the dashboard, then switch test mode off.
- Set floors after your first week of live bid data.
- Review bid-loss reasons weekly and watch rewarded fill by geo. Tier-two gaps are the first thing additional demand closes.
YOUR_APP_ID and YOUR_PLACEMENT_ID above are placeholders. Copy the real values from your dashboard under Settings → Inventory; they are unique per app and per placement.