0% found this document useful (0 votes)
16 views12 pages

Group 7 Handling Platform Differences

.NET MAUI simplifies cross-platform development by allowing a single codebase for native applications across Android, iOS, Windows, macOS, and the Web. It manages platform differences through handlers that connect shared UI controls to native elements, supports conditional compilation, and provides a unified access to device APIs. Additionally, it integrates Blazor Hybrid for web components while maintaining platform-specific capabilities and styling.

Uploaded by

mjgagnao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views12 pages

Group 7 Handling Platform Differences

.NET MAUI simplifies cross-platform development by allowing a single codebase for native applications across Android, iOS, Windows, macOS, and the Web. It manages platform differences through handlers that connect shared UI controls to native elements, supports conditional compilation, and provides a unified access to device APIs. Additionally, it integrates Blazor Hybrid for web components while maintaining platform-specific capabilities and styling.

Uploaded by

mjgagnao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Handling Platform

Differences
(Android, iOS, Web)

By:
Jyrillen Segobre
Angel Ann Gonzaga
Mark Leonel De Isidro
Introduction
NET MAUI plays a crucial role in simplifying cross-
platform development by enabling developers to use a single
codebase to build native applications for Android, iOS,
Windows, macOS, and even the Web via Blazor Hybrid. It
bridges platform differences through a unified API, platform-
specific handlers, and extensibility options, ensuring that apps
not only look and feel native but also leverage unique platform
capabilities. By streamlining development and reducing
duplication, .NET MAUI significantly improves productivity,
consistency, and performance in multi-platform application
development.
.Net MAUI Supported
platforms:

• Mobile: Android and Ios


• Desktop: Windows and
macOS
• Web: Indirect support
through Blazor Hybrid
Integration
How does .Net MAUI handles
platform differences?
.NET MAUI manages platform differences using
handlers to map UI controls to native elements on Android, iOS,
Windows, and macOS, enabling a consistent app experience. It
supports conditional compilation and dependency injection for
unique platform features. The MAUI Essentials library provides
unified access to device APIs, and XAML styling ensures
consistent cross-platform design with flexibility for tweaks.
Differences in Platform Capabilities
Feature Android iOS Web
Navigation Back button No hardware back Browser-based
manged by OS. button; handled navigation model.
programmatically.
UI Framework Material Design Human Interface HTML, CSS
Principles. Guidelines (HIG). rendered in Blazor.
Permissions Runtime permission Granular Permission handled
API. permission via browser.
handling via
Info.plist.
Deployment Android APK or IOS App Store Hosted on web
AAB. package. server or
embedded.
Custom Features Intents (e.g., Features like Face Limited by browser
sharing, NFC). ID, Haptics. capabilities.
Platform Rendering with
Handlers
● What are Handlers?
Handlers are the core mechanism in
.NET MAUI that bridges shared UI controls to
native elements on each platform.
For example:
How Handlers Work:
• Handlers in .NET MAUI connect cross-
platform controls, like a Button, to their
native versions on each platform.
• Example: Button -> Android Button, iOS
UIButton, Web (via Blazor) HTML
button.

Cuztomization:
• Developers can modify default handlers
to change behavior or appearance.
Example: Customize the corner radius of a
Button specifically for iOS.
Handling Platform-Specific Code
1. In .Net MAUI, we can use preprocessor directives like #if ANDROID, #if IOS, or #if
WINDOWS to include platform-specific code within a shared file.
Example:

2. Dependency Injection:
• Abstract platform-specific services behind shared interfaces.
• Example:
- File system operations differ for Android, Ios, and Web but are
abstracted through a shared interface IFileService.
Web Integration with Blazor Hybrid
What is Blazor Hybrid
• A feature that allows developers to embed Blazor (web-based) components within a
.NET MAUI app. It combines the strengths of native apps with the flexibility of web
development.

How it Works?
• Blazor components are written in C# and rendered as HTML/CSS within a WebView
control.
• These components can run within a native container in .NET MAUI, functioning
seamlessly across platforms like Android, iOS, Windows, and macOS.

Limitation
• No direct browser-based deployment from .NET MAUI (yet); relies on Blazor for web
functionality.
Styling and Theming Across Platforms

Android iOS Web

• Material Design • Follows Human • HTML and CSS


principles. Interface Guidelines. styling, with
• Emphasis on • Rounded corners, flexibility for custom
shadows, elevation, translucency, and themes.
and bold color smooth animations.
schemes.
Debugging and Testing Across Platforms
• Hot Reload:
Supports real-time updates to UI and code for Android,
iOS, and Web.

• Testing Tools:
Use NUnit, MSTest, or XUnit for shared logic.Platform-
specific tests for Android, iOS, or browser functionality.

• Cross-Platform Debugging:
Debug Android, iOS, and Web applications directly in
Visual Studio.
Thank You!

You might also like