Skip to content

wagenheimer/MAUIBleScanner

Repository files navigation

MAUI Bluetooth LE Scanner

A cross-platform Bluetooth Low Energy (BLE) scanner application built with .NET MAUI and Shiny framework.

Features

  • 🔍 Real-time BLE Device Scanning - Discover nearby Bluetooth LE devices
  • 📊 Signal Strength Monitoring - Visual indication of signal strength with color coding
  • 📱 Device Information Display - Shows device name, address, manufacturer data, and services
  • 🔄 Live Updates - Real-time updates of device information and timestamps
  • 🎯 Optimized Performance - Batch processing and efficient UI updates
  • 🚀 Modern UI - Clean and responsive interface built with .NET MAUI

Screenshots

Coming soon - Screenshots will be added here

Requirements

  • .NET 9.0 or later
  • Visual Studio 2022 17.8+ or Visual Studio Code with C# extension
  • Android SDK 21+ (for Android deployment)
  • iOS 12.2+ (for iOS deployment)

Getting Started

Prerequisites

  1. Install .NET 9.0 SDK
  2. Install Visual Studio 2022 with MAUI workload or VS Code with C# extension
  3. For Android development: Android SDK and emulator
  4. For iOS development: Xcode (macOS only)

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/MAUIBleScanner.git
cd MAUIBleScanner
  1. Restore NuGet packages:
dotnet restore
  1. Build the project:
# For Android
dotnet build -f net9.0-android

# For iOS (macOS only)
dotnet build -f net9.0-ios
  1. Run the application:
# For Android
dotnet run -f net9.0-android

# For iOS (macOS only)
dotnet run -f net9.0-ios

Permissions

The application requires the following permissions:

Android

  • BLUETOOTH - Access to Bluetooth adapter
  • BLUETOOTH_ADMIN - Bluetooth administration
  • BLUETOOTH_SCAN - Scan for Bluetooth devices (Android 12+)
  • BLUETOOTH_CONNECT - Connect to Bluetooth devices (Android 12+)
  • ACCESS_FINE_LOCATION - Required for BLE scanning
  • ACCESS_COARSE_LOCATION - Location access for device discovery

iOS

  • Bluetooth usage permission will be requested at runtime

Architecture

The application follows MVVM patterns and uses:

  • Shiny.BluetoothLE - Cross-platform Bluetooth LE library
  • Microsoft.Extensions.DependencyInjection - Dependency injection
  • System.Reactive - Reactive programming for async operations
  • .NET MAUI - Cross-platform UI framework

Project Structure

MAUIBleScanner/
├── Models/
│   └── BleDeviceInfo.cs          # Device information model
├── Converters/
│   └── IsNotNullOrEmptyConverter.cs # XAML value converter
├── MainPage.xaml                 # Main UI layout
├── MainPage.xaml.cs              # Main page logic
├── App.xaml                      # Application resources
├── App.xaml.cs                   # Application entry point
├── AppShell.xaml                 # Navigation shell
├── AppShell.xaml.cs              # Shell configuration
└── MauiProgram.cs                # Service configuration

Key Features Explained

Signal Strength Visualization

  • Green: Excellent signal (≥ -50 dBm)
  • Orange: Good signal (-70 to -50 dBm)
  • Red: Poor signal (< -70 dBm)

Performance Optimizations

  • Batch processing of scan results (500ms intervals)
  • Efficient UI updates using MainThread synchronization
  • Smart property change notifications to minimize re-renders
  • Device caching to prevent duplicate entries

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Dependencies

Troubleshooting

Common Issues

  1. No devices found

    • Ensure Bluetooth is enabled
    • Grant location permissions
    • Check if there are BLE devices nearby
    • Verify app has necessary permissions
  2. Build errors on iOS

    • Ensure you're building on macOS
    • Check Xcode installation
    • Verify iOS SDK is installed
  3. Permission errors

    • Check AndroidManifest.xml for required permissions
    • Ensure runtime permissions are granted

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Shiny Framework for excellent Bluetooth LE support
  • .NET MAUI for cross-platform development
  • Community contributors and testers

Support

If you encounter any issues or have questions:

  1. Check the Issues page
  2. Create a new issue with detailed information
  3. Include device information, OS version, and error messages

About

Dotnet MAUI BLEScanner (iOS and Android)

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages