Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/docs/android/guides/migrations/migrating-to-v2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The `PaywallComposable` has been removed from the main Superwall SDK and moved i
To use it, besides including the main superwall library, you'll now need to also include a `superwall-compose` artifact

```gradle
implementation "com.superwall.sdk:superwall-compose:2.5.6"
implementation "com.superwall.sdk:superwall-compose:2.6.5"
```

## 2\. Replacing getPaywall with PaywallBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,19 @@ class SWDelegate : SuperwallDelegate {
}
is RedemptionResult.Success -> {
val email = result.redemptionInfo.purchaserInfo.email
val productIdentifier = result.redemptionInfo.paywallInfo?.productIdentifier

if (email != null) {
Superwall.instance.setUserAttributes(mapOf("email" to email))
showToast("Welcome, $email!")
} else {
showToast("Welcome!")
}

// Access the product identifier if available (2.6.3+)
productIdentifier?.let {
Log.d("Superwall", "Redeemed product: $it")
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion content/docs/android/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ If you have feedback on any of our docs, please leave a rating and message at th

If you have any issues with the SDK, please [open an issue on GitHub](https://github.com/superwall/superwall-android/issues).

<SdkLatestVersion version="2.3.5" repoUrl="https://github.com/superwall/Superwall-Android" />
<SdkLatestVersion version="2.6.5" repoUrl="https://github.com/superwall/Superwall-Android" />
6 changes: 3 additions & 3 deletions content/docs/android/quickstart/install.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ can find the [latest release here](https://github.com/superwall/Superwall-Androi
<CodeGroup>

```gradle build.gradle
implementation "com.superwall.sdk:superwall-android:2.5.6"
implementation "com.superwall.sdk:superwall-android:2.6.5"
```

```kotlin build.gradle.kts
implementation("com.superwall.sdk:superwall-android:2.5.6")
implementation("com.superwall.sdk:superwall-android:2.6.5")
```

```toml libs.version.toml
[libraries]
superwall-android = { group = "com.superwall.sdk", name = "superwall-android", version = "2.5.6" }
superwall-android = { group = "com.superwall.sdk", name = "superwall-android", version = "2.6.5" }

// And in your build.gradle.kts
dependencies {
Expand Down
7 changes: 7 additions & 0 deletions content/docs/android/sdk-reference/PaywallOptions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class PaywallOptions {
var overrideProductsByName: Map<String, String> = emptyMap()
var optimisticLoading: Boolean = false
var timeoutAfter: Duration? = null
var onBackPressed: ((PaywallInfo?) -> Boolean)? = null
}
```

Expand All @@ -55,6 +56,7 @@ class PaywallOptions {
| `overrideProductsByName` | `Map<String, String>` | Overrides products on all paywalls using name→identifier mapping (e.g., `"primary"` → `"com.example.premium_monthly"`). |
| `optimisticLoading` | `Boolean` | Hides shimmer optimistically. Defaults to `false`. |
| `timeoutAfter` | `Duration?` | Duration until a paywall timeout is invoked. When not using fallback loading, setting this triggers a timeout instead of retrying. |
| `onBackPressed` | `((PaywallInfo?) -> Boolean)?` | Callback invoked when back button is pressed (requires `reroute_back_button` enabled in paywall settings). Return `true` to consume the back press, `false` to use SDK default behavior. Defaults to `null`. |
</ParamTable>

## Usage
Expand All @@ -72,6 +74,11 @@ val paywallOptions = PaywallOptions().apply {
)
optimisticLoading = false
timeoutAfter = null
onBackPressed = { paywallInfo ->
// Custom back button handling
// Return true to consume the back press, false to use SDK default
false
}
}

val options = SuperwallOptions().apply {
Expand Down
59 changes: 59 additions & 0 deletions content/docs/android/sdk-reference/Superwall.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,65 @@ Set delegate:
Superwall.instance.delegate = this
```

Consume a purchase (2.6.2+):
```kotlin
// Using coroutines
lifecycleScope.launch {
val result = Superwall.instance.consume(purchaseToken)
result.fold(
onSuccess = { token ->
println("Purchase consumed: $token")
},
onFailure = { error ->
println("Failed to consume: ${error.message}")
}
)
}

// Using callback
Superwall.instance.consume(purchaseToken) { result ->
result.fold(
onSuccess = { token ->
println("Purchase consumed: $token")
},
onFailure = { error ->
println("Failed to consume: ${error.message}")
}
)
}
```

Show an alert over the current paywall (2.5.3+):
```kotlin
Superwall.instance.showAlert(
title = "Important Notice",
message = "Your subscription will renew soon",
actionTitle = "View Details",
closeActionTitle = "Dismiss",
action = {
// Handle action button tap
navigateToSubscriptionSettings()
},
onClose = {
// Handle close/dismiss
println("Alert dismissed")
}
)
```

Set integration attributes for analytics (2.5.3+):
```kotlin
import com.superwall.sdk.models.attribution.AttributionProvider

Superwall.instance.setIntegrationAttributes(
mapOf(
AttributionProvider.ADJUST to "adjust_user_id_123",
AttributionProvider.MIXPANEL to "mixpanel_distinct_id_456",
AttributionProvider.META to "meta_user_id_789"
)
)
```

Java usage:
```java
// Access the instance
Expand Down
2 changes: 1 addition & 1 deletion content/docs/android/sdk-reference/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ If you have feedback on any of our docs, please leave a rating and message at th

If you have any issues with the SDK, please [open an issue on GitHub](https://github.com/superwall/superwall-android/issues).

<SdkLatestVersion version="2.3.5" repoUrl="https://github.com/superwall/Superwall-Android" />
<SdkLatestVersion version="2.6.5" repoUrl="https://github.com/superwall/Superwall-Android" />