We announced Xamarin.Essentials, a core set of cross-platform APIs to help developers build native apps, at Microsoft Build 2018. Xamarin.Essentials gives developers access to over thirty platform-specific APIs that can be accessed from their shared code, including geolocation, secure storage, sensors, device information, and many more. Best of all, Xamarin.Essentials can be used in any iOS, Android, UWP, or Xamarin.Forms app, regardless of how you create the user interface. Feedback on the first preview from developers has been fantastic, with praise of a simple and straightforward way to access these native features.
Today, we are pleased to release our second preview of Xamarin.Essentials (0.7.0-preview), which is available today on NuGet. This release combines feedback from developers, bug fixes, and several new APIs that you can take advantage of today.
Xamarin.Essentials first release gave developers access to the accelerometer, gyroscope, magnetometer, and compass. Based on your feedback, we’ve added an API for the orientation sensor. This API allows you to subscribe to reading changes that are reported back as a Quaternion, which describes rotation of the Earth’s coordinate system relative to the device’s coordinate system. This is extremely useful when creating applications that need access to 3D space.
When developing applications that process information in the background, it’s important to update the user interface on the main thread. With the MainThread API, you now have access to detect if you’re currently on the main thread and also begin an update on the main thread. We use this API internally to optimize our own code in Xamarin.Essentials.
Simplified Android Dependencies
Based on your feedback, Xamarin.Essentials is now built against Android 8.1 (API 27), with the updated dependencies of two Android Support libraries, CustomTabs and Core.Utils. This means you will need to ensure you have your Xamarin.Android project set to compile against Android 8.1 (API 27), which you can set in the properties of your project.
Remember, it’s important to have the saved version of all Android Support libraries in your project; now is a good time to update all of your dependencies in your project.
Xamarin.Essentials In Action
Ready to learn more about Xamarin.Essentials? Look no further than the latest Xamarin Show: Snack Pack, which gives a full overview of Xamarin.Essentials and how to start integrating it into your app.
Read more about this release in our full release notes and be sure to browse through our full documentation, which has a full overview of how to get started and how to use every feature of Xamarin.Essentials.