Xamarin.EssentialsXamarin.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 Information – Find out information about 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.
  • 羅盤:監視羅盤的變更。Compass – Monitor compass for changes.
  • 連線:檢查連線狀態和偵測變更。Connectivity – Check connectivity state and detect changes.
  • 裝置顯示器資訊:取得裝置的螢幕計量與方向。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 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.
  • 啟動器:讓應用程式可透過系統開啟 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.
  • 開啟瀏覽器:輕鬆快速地開啟瀏覽器至特定網站。Open Browser – Quickly and easily open a browser to a specific website.
  • 方向感應器:擷取裝置在三維空間中的方向。Orientation Sensor – Retrieve the orientation of the device in three dimensional space.
  • 電話撥號程式:開啟電話撥號程式。Phone Dialer – Open the phone dialer.
  • 偏好設定:輕鬆快速地新增永續性偏好設定。Preferences – Quickly and easily add persistent preferences.
  • 安全儲存體:安全地儲存資料。Secure Storage – Securely store data.
  • Share:將文字與網站 URI 傳送到其他應用程式。Share – Send text and website uris to other apps.
  • SMS:建立簡訊以傳送。SMS – Create an SMS message for sending.
  • 文字轉換語音:將裝置上的文字說出來。Text-to-Speech – Vocalize text on the device.
  • 版本追蹤:追蹤應用程式版本與組建編號。Version Tracking – Track the applications version and build numbers.
  • 震動:讓裝置震動。Vibrate – Make the device vibrate.

疑難排解Troubleshooting

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

API 文件API Documentation

瀏覽 API 文件以了解 Xamarin.Essentials 的每個功能。Browse the API documentation for every feature of Xamarin.Essentials.