What you get
-
First-class Jetpack Compose support
via the
PolstViewcomposable, plus an XMLViewfor legacy view-based screens. -
Native rendering — no
WebView, no JS bridge. The widget draws with the host app's Compose / Material 3 stack. - Offline cache — last-fetched polst payloads are persisted so the widget renders even when the device is offline.
-
Vote replay queue — votes cast offline
are queued in a local Room database and replayed by a
WorkManagerjob once connectivity returns. -
Encrypted device-id and token storage via
EncryptedSharedPreferences. -
Theming via
PolstThemeProviderwith built-in light / dark palettes (or roll your own).
Screenshots
PolstView.
View
surface for legacy screens.
Try it locally
-
Clone the embedding repo:
git clone git@github.com:ajcpwnz/polst-embedding.git. -
Open the
android/directory in Android Studio, or build the debug APK from the CLI:./gradlew :example:assembleDebug. -
Follow
android/README.mdfor sandbox-specific run notes. -
For SDK source, issues, and releases, see the upstream
polst-androidrepo.
Minimal Compose integration
The canonical "render a polst" call. Install the client
once at app startup, then drop a PolstView
anywhere in your Compose tree.
Copy this snippet
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.polst.sdk.PolstClient
import com.polst.sdk.core.theme.PolstTheme
import com.polst.sdk.core.theme.PolstThemeProvider
import com.polst.sdk.core.theme.light
import com.polst.sdk.ui.PolstView
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// One-time at app startup (typically Application.onCreate).
PolstClient.installDefault(PolstClient.forContext(this))
setContent {
PolstThemeProvider(theme = PolstTheme.light) {
Surface(modifier = Modifier.padding(24.dp)) {
PolstView(shortId = "abc123XYZ_")
}
}
}
}
}
Replace "abc123XYZ_" with any real 10-char
Polst short id. The snippet is shape-only; copy-paste it
into a Kotlin Activity to render a single polst end-to-end.