Android Introduction
Android support is experimental. Although it should work just fine, the API may change. Stay vigilant.
Voltra brings the power of JSX-based UI to Android Home Screen widgets. Using Jetpack Compose Glance under the hood, Voltra allows you to define Android widgets using a set of primitives that map directly to Glance components.
Widgets on Android
Android widgets have different layout and styling rules compared to iOS Live Activities. While iOS uses SwiftUI-based primitives (VStack, HStack, etc.), Android uses Jetpack Compose Glance primitives (Column, Row, Box).
Voltra abstracts these differences where possible, but provides platform-specific namespaces to ensure your UI looks and behaves correctly on each platform.
Simple Android Widget
Key Differences
- Primitives: Use
VoltraAndroid.Column,VoltraAndroid.Row, andVoltraAndroid.Boxinstead of stacks. - Alignment: Android uses specific alignment props like
verticalAlignmentandhorizontalAlignment. - Sizing: Use
"100%"for full size or"auto"for wrapping content.
Testing and Previews
You can preview your Android widgets directly in your app using the VoltraWidgetPreview component. This allows for fast iteration without needing to constantly check the home screen.
Learn more in the Testing and Previews guide.
Next Steps
Check out the Setup guide to set up Voltra for Android.
