Skip to main content

Samples and Tutorials

This section provides links to sample applications and end-to-end tutorials for integrating the MOSA SDK.

Sample Applications​

Android​

  • Example App: MOSA-dock-lib-android-example (contact MOSA for repository access)
  • Features: Complete Android integration example with Compose UI
  • Includes: Area list, session management, dock operations, sync status

iOS​

  • Example App: MosaSdkExample (contact MOSA for repository access)
  • Features: Complete iOS integration example with SwiftUI
  • Includes: Area list, session management, dock operations, sync status

Flutter​

  • Example App: mosa_dock_sdk_flutter/example (contact MOSA for repository access)
  • Features: Complete Flutter integration example
  • Includes: Cross-platform dock operations, callback handling, sync status

End-to-End Tutorials​

Tutorial 1: First Dock Connection​

Goal: Connect to your first MOSA dock and perform a test unlock operation.

Steps:

  1. Install SDK - Add SDK to your project
  2. Request Test Key - Request a testLock key
  3. Handle Callbacks - Implement callback handlers

Expected Result: Successfully connect to dock and receive callbacks.

Tutorial 2: Bike Parking Flow​

Goal: Implement complete bike parking functionality.

Steps:

  1. Follow Bike Parking Guide - Complete guide
  2. Lock Operation: Implement bike locking
  3. Unlock Operation: Implement bike unlocking
  4. Error Handling: Add comprehensive error handling
  5. UI Updates: Update UI based on callbacks

Expected Result: Full bike parking functionality working.

Tutorial 3: Bike Sharing Flow​

Goal: Implement complete bike sharing functionality.

Steps:

  1. Follow Bike Sharing Guide - Complete guide
  2. Rent Operation: Implement bike rental
  3. Return Operation: Implement bike return
  4. Rental Timer: Track rental duration
  5. Session Management: Handle session lifecycle

Expected Result: Full bike sharing functionality working.

Use Case Examples​

Example 1: Simple Unlock​

Minimal example showing basic unlock operation:

val sdk = MOSADockSDK.builder()
.setActivity(this)
.setApiKey("your-api-key")
.setUserId("user-123")
.build()

lifecycleScope.launch {
val unlockKey = sdk.requestUnlockKey(
type = MOSADockUnlockKeyType.BikeUnlock,
areaId = "area-123"
)

unlockKey?.let {
sdk.unlockSmartLock(
unlockKey = it,
gfaLocationType = MOSADockLocationType.PARKING,
callback = object : MOSADockSDKCallback {
override fun onDockUnlocked() {
println("Bike unlocked!")
}
override fun onError(error: MosaError) {
println("Error: ${error.message}")
}
// Implement other callbacks...
}
)
}
}

Getting Help​


For more examples, see the Use Case Guides.