Introduction
Codox real-time collaboration can be integrated into mobile applications using platform-specific implementations of the WebView component.
Overview
A WebView is a component that allows mobile applications to display web content (HTML, CSS, and JavaScript) directly within the app. It functions as an embedded mini-browser and enables interaction between the app’s native code and the loaded web content. While the syntax for interacting with a WebView varies across platforms (Kotlin, Flutter, or Swift), the integration process follows a consistent approach.
Main steps
-
Add the Codox JavaScript Library to Your Project: download and include the Codox JavaScript library in your project’s assets. This library handles synchronization and collaboration logic.
-
Create the Editor Component: develop the editor component in JavaScript. The component should include all necessary editor markup and logic. If you’re new to creating editor components, refer to Codox’s basic editor setup documentation to get started.
-
Load the Editor and Codox Library in a WebView: Use the WebView implementation specific to your platform to load the local HTML file that includes the editor and Codox scripts. Ensure the WebView’s base URL is configured correctly, as this is critical for Codox synchronization. (See platform-specific guides for examples.)
-
Implement a Communication Layer: establish a communication layer between the Codox JavaScript library and the native application. This layer:
- Triggers: start and stop Codox sessions.
- Receives messages: Handle events from Codox, such as content updates or user activity notifications.
- Uses platform-specific WebView messaging APIs to facilitate this communication (e.g., postMessage for JavaScript-to-native messaging and native callbacks for app-to-JavaScript communication).
Supported Platforms
Guidance and examples for integration with the following mobile platforms are provided in this section:
Flutter: Cross-platform UI toolkit.
Kotlin: Android development language.
Swift: iOS development language.