Integrate Sparkling into an existing app
This guide shows how to embed Sparkling containers into an existing Android/iOS project without regenerating your app from a template.
Android
Add dependencies
- Sparkling SDK
The core container and Lynx integration. Add the published Maven artifact:
- Sparkling Method
Sparkling Method provides typed JS ↔ native bridge modules such as router, storage, and media. Each module exposes native capabilities (page navigation, persistent storage, camera/album access, etc.) to your Lynx code via a generated pipe interface. You can also create custom methods to expose your own native APIs.
Add method packages to your JS project and run npx sparkling autolink — the CLI will update Gradle config and generate the native registry automatically.
Initialize HybridKit (Application.onCreate)
The host must initialize HybridKit and configure Lynx before opening any containers.
The template does this in SparklingApplication:
Provide bundle assets
Build your Lynx bundles in your JS project, then copy the generated .lynx.bundle files into your
Android assets (commonly app/src/main/assets). The bundle= parameter in your hybrid://...
scheme must match the asset path/name you copy into the app.
Open a page
The Android SDK provides SparklingContext and Sparkling.build(...).navigate():
iOS
Add dependencies
- Sparkling SDK
The core container and Lynx integration:
- Sparkling Method
Sparkling Method provides typed JS ↔ native bridge modules such as router, storage, and media. Each module exposes native capabilities (page navigation, persistent storage, camera/album access, etc.) to your Lynx code via a generated pipe interface. You can also create custom methods to expose your own native APIs.
Then run pod install (or bundle exec pod install if you use Bundler).
Initialize services (App startup)
The template's AppDelegate registers services and boot tasks:
Provide bundle assets
Build your Lynx bundles in your JS project, then add/copy the generated .lynx.bundle files into
your Xcode target resources so they're included in the final app bundle. The bundle= parameter in
your hybrid://... URL must match the bundled resource path/name.
Open content
Two common hosting styles:
- Push a Sparkling container controller (router):
- Embed a container view:
Verify & troubleshoot
- Build platform artifacts (
./gradlew assembleDebug,xcodebuild) and open ahybrid://URL to confirm rendering and pipe calls. - Blank screen / failed to load: verify the
bundle=name exists in app assets and your scheme matches the host type (lynxview_page,lynxview_card, etc.). See Scheme for details. - Router methods do nothing: ensure you registered the native IDL methods and that the JS side
calls match the same method names (e.g.
router.open).

