Xamarin.Essentials allows developers to add various common features to an app using the Xamarin framework without needing to build that feature from scratch.
These features come in the form of APIs that can be integrated into a mobile app.
The benefit of this library of APIs is that developers don’t have to reinvent the wheel if an app requires a common feature, which saves time and money on a project. This accelerates the rapid prototyping process, as we get to testing quicker.
Xamarin.Essentials isn’t just for Xamarin.Forms (cross platform mobile) apps, the libraries can be used with Xamarin native iOS and Android apps.
I spoke to Eastpoint’s Oli about what these features are, and how Xamarin.Essentials is used.
Who makes the Xamarin Essentials APIs?
The libraries began as ‘plugins’ or ‘components’ by the Xamarin community to provide a cross-platform way of doing things like openings maps, getting location data and making phone calls within an app etc. A community of Xamarin developers created these libraries at the time, and it wasn’t called Xamarin.Essentials. This was before Xamarin was acquired by Microsoft.
A strong contributor to these components was James Montemagno, who worked for Xamarin the company. Once Xamarin was bought by Microsoft, a team spear-headed by James Montemagno revamped the collection of these open-source libraries and packaged them up together as Xamarin.Essentials.
While Microsoft is open to submissions and the libraries are on GitHub, it is not a free for all. The APIs are created and maintained by Microsoft.
Can I trust Xamarin Essentials?
Xamarin.Essentials is open source and therefore open to public scrutiny. It is also free (open source software does not necessarily mean is it available for free).
This community feedback means the standard of code is both high and consistent. If anyone finds an issue – such as us during a mobile app project – Microsoft would listen to our feedback and take on board suggestions and this is achieved through a publicly visible platform.
The libraries are maintained by Microsoft and there are dedicated resources to improve and update the existing libraries if need be.
Do I need to know if my app uses Xamarin Essentials?
The APIs are free and available for all to use with no commercial obligation, so it is more of a developer choice and probably not something a client would not need to interact with.
Are Xamarin Essentials libraries updated automatically?
In terms of a mobile application that consumes the library, the app does not automatically update when Xamarin.Essentials has received an update.
If there is an improvement available after the app was built and distributed, a developer needs to actively update their code base to reference the updated Xamarin.Essentials API within the code base. It is entirely a developer tool.
Is there any reason not to use Xamarin Essentials?
It would depend on the technical details, but the majority of the time you would benefit from using Xamarin.Essentials than not. It does have some limitations and if a developer has a very specific use case (a particular scenario to achieve) in mind, it may not deliver what is needed.
An example being the current Xamarin.Essentials geo-location API, it does not perform continuous background polling (often needed when doing location tracking) unless implemented manually. Other libraries with geo-location capabilities may offer this feature and a developer may chose those over Xamarin.Essentials.
But you can extend the plugins in this way, so they are still useful.
What is Oli’s favourite API?
Geo-location is still my favourite. We work on many apps that are location-aware so I use it frequently. There is also one called File System Helpers. It really does help! It can be used for things like storing photos in cross platform apps, where each platform (Android, iOS) does things differently. Yes, yes, yes!