Xamarin.Essentials

Xamarin.Essentials 為開發人員提供行動應用程式的跨平臺 Api。Xamarin.Essentials provides developers with cross-platform APIs for their mobile applications.

Android、iOS 與 UWP 提供獨一無二的作業系統與平台 API,開發人員可以在 C# 中使用 Xamarin 存取全部項目。Android, iOS, and UWP offer unique operating system and platform APIs that developers have access to all in C# leveraging Xamarin. Xamarin.Essentials 提供單一跨平臺 API,適用于任何 Xamarin.Forms 、Android、iOS 或 UWP 應用程式,無論使用者介面的建立方式為何,都可以從共用程式碼存取這些應用程式。Xamarin.Essentials provides a single cross-platform API that works with any Xamarin.Forms, Android, iOS, or UWP application that can be accessed from shared code no matter how the user interface is created.

開始 Xamarin.EssentialsGet Started with Xamarin.Essentials

遵循 快速入門手冊 ,將 Xamarin.Essentials NuGet 套件安裝到現有或新 Xamarin.Forms 的、ANDROID、iOS 或 UWP 專案。Follow the getting started guide to install the Xamarin.Essentials NuGet package into your existing or new Xamarin.Forms, Android, iOS, or UWP projects.

功能指南Feature Guides

遵循下列指南,將這些 Xamarin.Essentials 功能整合到您的應用程式中:Follow the guides to integrate these Xamarin.Essentials features into your applications:

  • 加速計:擷取裝置在三維空間中的加速度資料。Accelerometer – Retrieve acceleration data of the device in three dimensional space.
  • 應用程式動作-取得和設定應用程式的快捷方式。App Actions – Get and set shortcuts for the application.
  • 應用程式資訊:了解應用程式的相關資訊。App Information – Find out information about the application.
  • 應用程式主題 –偵測應用程式所要求的目前主題。App Theme – Detect the current theme requested for the application.
  • 氣壓計:監視氣壓計的壓力變化。Barometer – Monitor the barometer for pressure changes.
  • 電池:簡單地偵測電池電量、來源和狀態。Battery – Easily detect battery level, source, and state.
  • 剪貼簿:輕鬆快速地設定或讀取剪貼簿上的文字。Clipboard – Quickly and easily set or read text on the clipboard.
  • 色彩轉換器 - System.Drawing.Color 的 Helper 方法。Color Converters – Helper methods for System.Drawing.Color.
  • 羅盤:監視羅盤的變更。Compass – Monitor compass for changes.
  • 連線:檢查連線狀態和偵測變更。Connectivity – Check connectivity state and detect changes.
  • 連絡人 –取得裝置上連絡人的相關資訊。Contacts – Retrieve information about a contact on the device.
  • 偵測搖動 - 可偵測裝置的搖動。Detect Shake – Detect a shake movement of the device.
  • 裝置顯示器資訊:取得裝置的螢幕計量與方向。Device Display Information – Get the device's screen metrics and orientation.
  • 裝置資訊:輕鬆地了解裝置。Device Information – Find out about the device with ease.
  • 電子郵件:輕鬆地傳送電子郵件訊息。Email – Easily send email messages.
  • 檔案選擇器–允許使用者從裝置挑選檔案。File Picker – Allow user to pick files from the device.
  • 檔案系統協助程式:輕鬆地將檔案儲存到應用程式資料。File System Helpers – Easily save files to app data.
  • 手電筒:簡單地開啟/關閉手電筒的方式。Flashlight – A simple way to turn the flashlight on/off.
  • 地理編碼:地理編碼和反向地理編碼地址與座標。Geocoding – Geocode and reverse geocode addresses and coordinates.
  • 地理位置:擷取裝置的 GPS 位置。Geolocation – Retrieve the device's GPS location.
  • 陀螺儀:追蹤裝置的三個主座標軸旋轉角度。Gyroscope – Track rotation around the device's three primary axes.
  • Haptic 意見 反應– ctrl + click 和 long click haptics。Haptic Feedback – Control click and long press haptics.
  • 啟動器:讓應用程式可透過系統開啟 URI。Launcher – Enables an application to open a URI by the system.
  • 磁力計:偵測裝置相對於地球磁場的方向。Magnetometer – Detect device's orientation relative to Earth's magnetic field.
  • 主執行緒:在應用程式的主執行緒上執行程式碼。MainThread – Run code on the application's main thread.
  • 地圖:開啟地圖應用程式至特定位置。Maps – Open the maps application to a specific location.
  • 媒體選擇器 –允許使用者選擇或拍攝相片和影片。Media Picker – Allow user to pick or take photos and videos.
  • 開啟瀏覽器:輕鬆快速地開啟瀏覽器至特定網站。Open Browser – Quickly and easily open a browser to a specific website.
  • 方向感應器:擷取裝置在三維空間中的方向。Orientation Sensor – Retrieve the orientation of the device in three dimensional space.
  • 許可權 –檢查並要求使用者的許可權。Permissions – Check and request permissions from users.
  • 電話撥號程式:開啟電話撥號程式。Phone Dialer – Open the phone dialer.
  • 平台擴充 - 可轉換矩形、大小及點的 Helper 方法。Platform Extensions – Helper methods for converting Rect, Size, and Point.
  • 偏好設定:輕鬆快速地新增永續性偏好設定。Preferences – Quickly and easily add persistent preferences.
  • 螢幕擷取畫面 -取得應用程式目前的顯示。Screenshot – Take a capture of the current display of the application.
  • 保護儲存體:安全地儲存資料。Secure Storage – Securely store data.
  • 共用 –將文字和網站連結傳送至其他應用程式。Share – Send text and website links to other apps.
  • SMS:建立簡訊以傳送。SMS – Create an SMS message for sending.
  • 文字轉換語音:將裝置上的文字說出來。Text-to-Speech – Vocalize text on the device.
  • 單位轉換器 - 可轉換單位的 Helper 方法。Unit Converters – Helper methods to convert units.
  • 版本追蹤:追蹤應用程式版本與組建編號。Version Tracking – Track the applications version and build numbers.
  • 震動:讓裝置震動。Vibrate – Make the device vibrate.
  • Web 驗證器-啟動 Web 驗證流程,並接聽回呼。Web Authenticator - Start web authentication flows and listen for a callback.

疑難排解Troubleshooting

在您遇到問題時可尋找說明。Find help if you are running into issues.

Xamarin.Essentials 在 Q&AXamarin.Essentials on Q&A

詢問有關使用存取原生功能的問題 Xamarin.Essentials 。Ask questions about accessing native features with Xamarin.Essentials.

版本資訊Release Notes

尋找每個版本的完整版本資訊 Xamarin.Essentials 。Find full release notes for each release of Xamarin.Essentials.

API 檔API Documentation

流覽 API 檔以取得的每項功能 Xamarin.Essentials 。Browse the API documentation for every feature of Xamarin.Essentials.