Loading...
Searching...
No Matches
MqttSession Directory Reference

Directories

 dart
 
 java
 
 kotlin
 
 objc
 
 swift
 

Detailed Description

This directory contains comprehensive usage examples for the MqttSession module across all supported platforms.

Overview

The MqttSession module provides MQTT connectivity for publishing position data to MQTT brokers, including:

Covered Classes and Methods

MqttSession

MqttSessionListener

Platform-Specific Examples

Java

Kotlin

Objective-C

Swift

Dart/Flutter

Key Features Demonstrated

1. Basic MQTT Connection

2. Connection Configuration

3. Listener Management

4. Position Data Publishing

Configuration

All examples use the following configuration:

Topic Format

The MqttSession creates the final topic using the following template:

Sub-Topic Validation

The subTopic parameter is validated:

Error Handling

Examples include comprehensive error handling for:

Threading and Concurrency

Memory Management

Integration Notes

NavigationManager Integration

MqttSession requires NavigationManager to be initialized:

  1. Get LocationManager from SDK
  2. Get NavigationManager using LocationManager
  3. Create MqttSession using NavigationManager

Position Data Publishing

When connected, MqttSession automatically publishes position data from NavigationManager:

Listener Pattern

Examples show proper implementation of the observer pattern:

Usage Instructions

  1. Setup: Replace USER-HASH-HERE with your actual user hash
  2. MQTT Broker: Configure MQTT broker hostname, port, username, and password
  3. Sub-Topic: Set appropriate MQTT sub-topic (must not be empty and must not contain slashes)
  4. NavigationManager: Ensure NavigationManager is properly initialized
  5. Run: Execute the example for your target platform
  6. Monitor: Watch console output for connection events and position publishing

Dependencies

All examples require the Navigine SDK to be properly installed and configured for each platform:

Troubleshooting

Common issues and solutions:

Next Steps

After understanding these examples, you can:

Support

For additional help: