Platform Implementation
Native setup and configuration for iOS and Android splash screens
Platform Implementation
Overview
Setting up splash screens requires platform-specific configuration for both iOS and Android. This guide provides detailed instructions for each platform, ensuring your splash screen displays correctly across all devices and OS versions.
Platform Differences
iOS and Android handle splash screens differently:
- iOS: Uses Storyboard files for launch screens
- Android: Uses drawable resources and themes (with special handling for Android 12+)
iOS Configuration
iOS uses Storyboard files for splash screens, which offers flexibility in layout and automatic handling of different device sizes.
Generate Assets
Use the CLI tool to generate iOS-specific assets:
This creates the necessary image assets and Storyboard files.
Configure Xcode Project
- Open iOS project in Xcode (
ios/YourProject.xcworkspace) - Set Launch Screen File in project settings:
- Select your project in the Project Navigator
- Go to "General" tab > "App Icons and Launch Screen"
- Set "Launch Screen File" to "BootSplash" (created by the generator)
iOS Customization Options
Custom Storyboard Layout
You can customize the generated Storyboard for more complex layouts:
- Open
BootSplash.storyboardin Xcode - Add additional UI elements (labels, secondary images, etc.)
- Use Auto Layout constraints for proper positioning
- Test on different device sizes using the preview
Dark Mode Support
To support dark mode with different assets:
- Create separate image sets for light and dark appearances
- In Xcode, select your image asset
- In the Attributes Inspector, change "Appearances" to "Any, Dark"
- Add appropriate images for each appearance
iOS Troubleshooting
Issue: Black screen appears instead of splash screen
Solutions:
- Ensure
UILaunchStoryboardNameis correctly set in Info.plist - Verify the Storyboard file is included in the build target
- Check that image assets are properly linked
- Clean build folder and rebuild:
Product > Clean Build Folder
Android Configuration
Android splash screen implementation varies based on the Android version, with Android 12+ introducing a new SplashScreen API.
Android 12+ Specific Configuration
Android 12 introduced a new SplashScreen API with specific requirements:
Android 12 Requirements
- Splash screens are mandatory on Android 12+
- The system enforces specific design constraints
- Custom animations are limited compared to earlier versions
Additional Configuration for Android 12+
-
Update
styles.xmlfor Android 12+ (createvalues-v31/styles.xml): -
Handle the splash screen duration:
Dark Mode Support for Android
To support dark mode on Android:
-
Create dark mode colors (
values-night/colors.xml): -
Provide dark mode drawable if needed:
- Place dark mode logo in
drawable-night-*dpifolders - Or use vector drawables with theme colors
- Place dark mode logo in
Android Troubleshooting
Issue: White flash appears before splash screen
Solutions:
- Ensure
super.onCreate(null)passes null parameter - Set
android:windowDisablePreviewto true in theme - Check that theme is properly applied in AndroidManifest.xml
- Verify background color matches your splash screen
Platform-Specific Best Practices
iOS Best Practices
- (Do ✅) Use vector images (PDF) when possible for better scaling
- (Do ✅) Test on all device sizes including iPad if supported
- (Do ✅) Keep Storyboard simple to avoid loading delays
- (Don't ❌) Include text in images - use Storyboard labels for localization
- (Consider 🤔) Using SF Symbols for system-consistent icons
Android Best Practices
- (Do ✅) Use vector drawables for logos when possible
- (Do ✅) Test on Android 12+ devices for new API compliance
- (Do ✅) Provide all density resources (mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi)
- (Don't ❌) Use large bitmap images that could cause OOM errors
- (Be Aware ❗) Of status bar handling - it may overlay your content
Testing Your Implementation
iOS Testing Checklist
- Test on iPhone SE (smallest screen)
- Test on iPhone Pro Max (largest screen)
- Test on iPad (if supported)
- Verify landscape orientation (if supported)
- Check dark mode appearance
- Verify no layout shifts during transition
Android Testing Checklist
- Test on Android 8 (API 26)
- Test on Android 12+ (API 31+)
- Test on small screen devices
- Test on tablets (if supported)
- Verify dark mode appearance
- Check different aspect ratios (16:9, 18:9, 19:9)
Summary
Platform-specific implementation requires attention to detail and thorough testing. Key takeaways:
- iOS: Focus on Storyboard configuration and Auto Layout
- Android: Handle version differences, especially Android 12+
- Both: Support dark mode and test on various devices
- Assets: Use appropriate formats and resolutions
- Testing: Verify on real devices when possible
Next Steps
- Configure Design & Assets for optimal visual quality
- Set up Integration with App Initialization
- Explore White-Label Support for multi-brand apps