.NET Documentation

Mobile Applications

Chat App Sample

This sample demonstrates how to build a real-time chat application using .NET MAUI and SignalR. It covers essential aspects of mobile app development, including UI design, data binding, and real-time communication.

Sample Preview

Chat App Screenshot

A glimpse into the intuitive user interface of our chat application.

Key Features

  • Real-time message exchange with SignalR.
  • User authentication and presence indication.
  • Cross-platform compatibility with .NET MAUI.
  • Modern and responsive UI design.
  • Error handling and offline support considerations.

Getting Started

To explore the code and run the sample, follow these steps:

  1. Clone the Repository: Use Git to clone the sample project from our GitHub repository.
    git clone https://github.com/dotnet/samples/chat-app-maui.git
  2. Set up your Environment: Ensure you have .NET MAUI development tools installed. Refer to the official .NET MAUI setup guide.
  3. Build and Run: Navigate to the project directory and build the application for your target platform (iOS, Android, Windows, or macOS).
    cd chat-app-maui
    dotnet build -t:Run -f net7.0-android

Code Structure

The project is organized into several key areas:

  • Platforms/: Contains platform-specific implementations.
  • Resources/: Holds assets like images and styles.
  • ViewModels/: Implements the ViewModel pattern for MVVM.
  • Services/: Contains business logic and SignalR client implementations.
  • Pages/: Defines the UI for different screens.

Technical Details

This sample leverages the following technologies:

  • .NET MAUI: For building cross-platform native UIs with a single codebase.
  • SignalR: For enabling real-time web functionality.
  • MVVM Architecture: Promotes code separation and testability.
  • C#: The primary programming language.
Download Sample Project View on GitHub