Kotlin Multiplatform BLE library for iOS, Android, macos, windows and javascript
This directory contains example projects demonstrating Blue Falcon usage across different platforms and architectures.
Platform: Kotlin Multiplatform
Language: Kotlin
Description: Proof-of-concept demonstrating the Blue Falcon 3.0 architecture
Features:
Location: ArchitecturePOC/
See: ArchitecturePOC/README.md for details
Platform: Kotlin Multiplatform
Language: Kotlin
Description: Examples of creating custom Blue Falcon plugins
Features:
Location: Plugin-Example/
See: Plugin-Example/README.md for details
Platform: Kotlin Multiplatform
Language: Kotlin
Description: Example of creating a custom platform engine
Features:
Location: Engine-Example/
See: Engine-Example/README.md for details
Platform: Compose Multiplatform (Android + iOS)
Language: Kotlin
Description: Production-ready example with Compose UI using Blue Falcon 3.0 API
Features:
Location: ComposeMultiplatform-3.0-Example/
See: ComposeMultiplatform-3.0-Example/README.md for details
Key Highlights:
val blueFalcon = BlueFalcon {
install(LoggingPlugin) { level = LogLevel.DEBUG }
install(RetryPlugin) { maxRetries = 3 }
}
// Collect devices as Flow
blueFalcon.peripherals.collect { devices ->
// Update UI
}
// Use suspend functions
blueFalcon.scan()
blueFalcon.connect(device)
Platform: Compose Multiplatform (Android + iOS)
Language: Kotlin
Description: Production-ready example with Compose UI using Blue Falcon 2.x (legacy) API
Features:
Location: ComposeMultiplatform-Legacy-Example/
See: ComposeMultiplatform-Legacy-Example/README.md for details
Key Pattern:
class BleDelegate: BlueFalconDelegate {
override fun didConnect(peripheral: BluetoothPeripheral) {
// Handle connection via callback
}
}
val blueFalcon = BlueFalcon(context, delegate)
blueFalcon.scan()
⚠️ Note: This is the legacy API. For new projects, use ComposeMultiplatform-3.0-Example instead
Platform: JavaScript (Web Browser)
Language: Kotlin/JS
Description: Web Bluetooth API example
Features:
Location: JS-Example/
Running:
cd JS-Example
./gradlew jsBrowserDevelopmentRun
# Open http://localhost:8080
Requirements:
val blueFalcon = BlueFalcon(log = null, ApplicationContext())
blueFalcon.delegates.add(object : BlueFalconDelegate {
override fun didDiscoverDevice(
peripheral: BluetoothPeripheral,
advertisementData: Map<AdvertisementDataRetrievalKeys, Any>
) {
println("Found: ${peripheral.name}")
}
})
blueFalcon.scan()
import dev.bluefalcon.core.*
import dev.bluefalcon.engine.android.*
import dev.bluefalcon.plugins.logging.*
val blueFalcon = BlueFalcon {
engine = AndroidEngine(context)
install(LoggingPlugin) {
level = LogLevel.DEBUG
}
}
launch {
blueFalcon.peripherals.collect { devices ->
devices.forEach { println("Device: ${it.name}") }
}
}
blueFalcon.scan()
For complete guides and API documentation:
Want to contribute an example? We’d love to have:
Guidelines:
See CONTRIBUTING.md for details.