How to Integrate and Initialize the epuBear SDK
Updated
epuBear is a closed-source, cross-platform EPUB reader SDK. You integrate it by adding the wrapper that matches your development environment — Kotlin (Android), Swift (iOS), C# (MAUI), or Dart (Flutter) — then constructing an SDK instance with a config object that carries your company name, app name, license key, and a writable files directory. The steps below cover the Android and iOS initialization paths shown in the official documentation, plus the basic calls you make right after init.
What the SDK is made of
epuBear ships as two layers:
- A closed-source cross-platform core that does the actual EPUB parsing and rendering.
- Language wrappers that expose that core to your project. The documented wrappers are Kotlin (Android), Swift (iOS), C# (MAUI), and Dart (Flutter).
Because the core is shared, the same feature set is available regardless of which wrapper you pick. The documented capabilities include EPUB 2 and EPUB 3 compatibility, reading files from storage or memory, extracting document information, rendering pages to bitmaps, multi-language support (including vertical and right-to-left writing), navigation, bookmarks, text search, selection with highlight/underline, notes, text-to-speech, audio/video playback inside EPUB content, and opening/zooming images.
Prerequisites
Before you write any code, confirm you have:
- A license key. The config object requires one, and the documentation states the full feature set is available upon purchase. Pricing terms are not published on the page, so treat licensing as a commercial step you complete before integration.
- A writable directory on the device for the SDK to use (the examples use the app's cache or files directory).
- The wrapper package for your platform added to your project.
Initialize on Android (Kotlin)
The documented pattern is to build an EpubearConfig, then construct EpubearSdk with it, then attach listeners and set display options.
val config = EpubearConfig(
companyName,
appName,
licenseKey,
ApplicationProvider.getAppContext().filesDir
)
epubear = EpubearSdk(ApplicationProvider.getAppContext(), config).apply {
setEventListener(this)
setCfiListener(this)
setAppearanceMode(EpubearSdk.EPUBAppearanceMode.EPUBAppearanceModeNormal)
setFontSize(0, false)
}
What each part does:
EpubearConfig(companyName, appName, licenseKey, filesDir)— identifies your app to the SDK and gives it a storage location. The fourth argument is the files directory from the application context.EpubearSdk(context, config)— creates the reader instance.setEventListener(this)— routes SDK events (for example, reading progress or state changes) to your listener.setCfiListener(this)— subscribes to CFI (canonical fragment identifier) updates, which is how you track and restore reading position.setAppearanceMode(...)— sets the reading theme; the example uses the normal appearance mode.setFontSize(0, false)— sets the text size. The two arguments let you pass a size and a flag; the example uses0andfalseas the starting values.
Initialize on iOS (Swift)
The iOS example begins by resolving a caches directory, which is the equivalent of the Android files directory:
guard let cachesDirectory = FileManager.default.urls(
for: .cachesDirectory,
in: .userDomainMask
).first
Use that directory when constructing the iOS config, then create the SDK instance and apply the same categories of setup — event listener, CFI listener, appearance mode, and font size — through the Swift wrapper. The wrapper names differ from Kotlin, but the sequence is the same: resolve a writable directory, build the config with your company name, app name, and license key, instantiate the SDK, then attach listeners and set display options.
Verify the integration
After initialization, check these before building features on top:
- The SDK instance is non-null and was created without a license or config error.
- Listeners fire — open a sample EPUB and confirm your event and CFI callbacks receive data.
- Display options take effect — change the appearance mode or font size and confirm the rendered page updates.
- A file loads — the SDK reads EPUB files either directly from file storage or loaded into memory, so test both paths if your app uses both.
Common sticking points
- Missing or invalid license key. The config constructor requires it; initialization is where a bad key surfaces.
- Unwritable directory. Passing a path the app cannot write to will break caching and rendering. Use the app's own files or caches directory, as both examples do.
- Forgetting the listeners. Without
setEventListenerandsetCfiListener, you get a reader that renders but does not report progress or position back to your app. - Assuming extra features are included. The documented feature list is what ships on purchase. If you need full or particular EPUB 3 support, DRM integration, or other custom functionality, the documentation states these are handled as custom solutions by the development team rather than being part of the standard SDK.