Integrate Sparkling into an existing app
This guide shows how to host Sparkling in an existing Android/iOS app: initialize the runtime, provide Lynx bundles, then open content via a hybrid scheme.
Quick Start (Manual Embed)
Embed Sparkling containers into an established Android/iOS project without regenerating your app from a template.
Android
-
Add the published Sparkling SDK dependency:
-
Build your Lynx bundles in your JS project, then copy the generated
.lynx.bundlefiles (and any referenced assets) into the Android assets directory you want to load from (commonlyapp/src/main/assets). -
Launch a container:
iOS
-
Add the published pods:
-
Run
pod install(orbundle exec pod installif you use Bundler). -
Open a page:
-
Customize navigation/loading/error views via
SPKViewControllerorSPKContainerViewas needed.
Build & verify
- Build your Lynx bundles by compiling your JS project (produce the
.lynx.bundlefiles). - Copy the bundles into your app’s Android/iOS assets/resources directories.
- Run platform builds (
./gradlew assembleDebug,xcodebuild) and open ahybrid://URL to confirm rendering and pipe calls.
What you need
- Native Sparkling SDK (container + Lynx integration)
- Your Lynx bundles (the compiled assets, typically under
dist/) - Optional: Sparkling Method modules (router/storage/custom) if you want JS ↔ native APIs
Android integration
1) Add the Sparkling dependency
The template app uses a Maven artifact:
2) Initialize HybridKit (Application.onCreate)
The host must initialize HybridKit and configure Lynx before opening any containers.
The template does this in SparklingApplication:
3) (Optional) Register Sparkling Methods
If you use method packages (router/storage/custom), you also register the native method implementations during initialization.
The template registers router methods:
4) Open a page (create SparklingContext + navigate)
The Android SDK provides SparklingContext and Sparkling.build(...).navigate():
5) Provide bundle assets
Your scheme must point at a bundle name that exists in the app’s 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.
iOS integration
1) Add Sparkling via CocoaPods
Use the published pods:
2) Initialize services (App startup)
The template’s AppDelegate registers services and boot tasks:
3) Open content
Two common hosting styles:
- Push a Sparkling container controller (router):
- Embed a container view:
4) Provide bundle assets
Your iOS app must bundle the Lynx output so Sparkling can resolve the bundle= parameter.
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.
Troubleshooting
- 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).

