Android
Android, from install to paywall
BillDog’s Android SDK 1.1.1-beta.5 comes from Maven Central. In a Jetpack Compose sample on a real Android phone, you add two Gradle dependencies, configure the SDK in your Application’s onCreate, register that class in the manifest with android:name, and show a paywall by its identifier. Skip the manifest step and the first call to getInstance throws because the SDK isn’t configured.
What this video covers: Filmed on a real Android phone with a sandbox key. No purchase is completed.
Transcript
This is a native Android app, and that paywall is Jetpack Compose, drawn by the SDK. What it took is two lines of Gradle and a few dozen lines of Kotlin.
It’s a small sample app we built for this video, running on a real Android phone. The code that matters is on screen.
Google and Maven Central in your repositories. The SDK publishes to Central, so there’s no custom Maven URL to add.
Then two dependencies. Compose, for the paywall screen and the core SDK. And the paywall artifact, for Google Play Billing. Compose alone doesn’t include billing. Without that second line, the SDK loads no store products, and every purchase fails.
Configure once, in your Application class’s onCreate. It’s ready before any activity can ask for a paywall.
Logging tied to BuildConfig.DEBUG turns the SDK’s debug logger on in debug builds, and off in release. Use your sandbox key here, and leave the environment on production. That setting picks the server.
Then register the class in your manifest. Without android:name, your Application class never runs, configure is never called, and the first call to getInstance throws an exception: the SDK is not configured.
Now show it. One call: the activity, and the identifier of the paywall you built in the dashboard. The paywall’s identifier, not a product’s. Note the compose import. Compose is an extension, and without that line, this doesn’t compile.
Two ways back. The handler hears about purchases: here it logs the product and closes the paywall. The trailing callback only tells you whether the paywall made it on screen. Don’t treat that one as a sale.
Two dependencies, configure in onCreate, register it in the manifest, and show by identifier.