Plugin Configuration (Android)
The Voltra Expo config plugin accepts Android-specific configuration options in your app.json or app.config.js:
Android-Specific Configuration
android.enableNotifications (optional)
Enables Android notification-related manifest plumbing used by Voltra features such as ongoing notifications.
When enabled, the config plugin adds:
android.permission.POST_NOTIFICATIONSandroid.permission.POST_PROMOTED_NOTIFICATIONSvoltra.VoltraOngoingNotificationDismissedReceiver
This does not grant runtime notification permission automatically. Your app still needs to request notification permission on Android 13 and above.
For setup and usage examples, see Managing Android Ongoing Notifications.
android.widgets (optional)
Array of widget configurations for Home Screen widgets. Each widget will be available in the Android widget picker.
Widget Configuration Properties:
id: Unique identifier for the widget (alphanumeric with underscores only)displayName: Name shown in the widget pickerdescription: Description shown in the widget pickertargetCellWidth: Target widget width in grid cells (1-5, required)targetCellHeight: Target widget height in grid cells (1-5, required)minCellWidth: (optional) Minimum width in grid cells (defaults to targetCellWidth)minCellHeight: (optional) Minimum height in grid cells (defaults to targetCellHeight)minWidth: (optional) Minimum width in dp (overrides minCellWidth calculation)minHeight: (optional) Minimum height in dp (overrides minCellHeight calculation)resizeMode: (optional) Widget resize behavior ("none"|"horizontal"|"vertical"|"horizontal|vertical", default:"horizontal|vertical")widgetCategory: (optional) Widget category ("home_screen"|"keyguard"|"home_screen|keyguard", default:"home_screen")initialStatePath: (optional) Path to a file that exports initial widget state (see Widget Pre-rendering)previewImage: (optional) Path to preview image for widget picker (PNG/JPG/WebP)previewLayout: (optional) Path to custom XML layout for widget picker preview (Android 12+)serverUpdate: (optional) Enable server-driven updates. See Server-driven widgets for full details.url: The Voltra SSR endpoint URLintervalMinutes: Update interval in minutes (default:15, minimum 15 per WorkManager)refresh: Show a native refresh button (default:false)
Widget Sizing
Grid Cells vs Density-Independent Pixels (dp)
Android uses grid cells to define widget sizes. By default, the formula is:
- minWidth/minHeight (dp) = (cellCount × 70) - 30
Example:
- 2 cells = (2 × 70) - 30 = 110 dp
- 4 cells = (4 × 70) - 30 = 250 dp
You can override this with explicit minWidth and minHeight in dp.
Standard Dimensions
Widget Picker Previews
When users add a widget to their home screen, Android displays a preview in the widget picker. Voltra supports three preview methods, with automatic fallback:
Preview Priority Chain
previewLayout(Android 12+) - Custom XML layout for scalable previewpreviewImage(All versions) - Static image or auto-generated layout- Default - System placeholder layout
Using previewImage
Static preview image for all Android versions:
When only previewImage is specified, Voltra automatically generates a layout that displays the image with proper scaling.
Using previewLayout
Custom XML layout for scalable previews (Android 12+):
Example todos-preview.xml:
The preview layout is rendered at the widget's target size and displayed in the widget picker.
Combined Preview Setup
For best results across Android versions:
This configuration:
- Uses
previewLayouton Android 12+ (scalable, accurate preview) - Falls back to
previewImageon Android 11 and earlier - Shows actual widget content on home screen via
initialStatePath(when available)
Widget Pre-rendering
Use initialStatePath to provide pre-rendered widget state:
When the app is built, Voltra pre-renders the widget at the specified path and bundles it as voltra_initial_states.json. The widget displays this content immediately when first added to the home screen, before any dynamic updates.
See Widget Pre-rendering for details on creating initial state files.
