Using .NET Delivery SDK in Xamarin
Lot of developers have been asking whether it's possible to use the Kentico Cloud .NET SDKs in Xamarin. The answer is: absolutely yes!
There are several conditions your project have to meet:
- the whole solution has to use the new NuGet format called PackageReference
- projects referencing Kentico Cloud SDKs need to target .NET Standard 1.3+
- projects referencing
Xamarin.Formsneed to have
<PackageTargetFallback>portable-net45+win8+wpa81+wp8</PackageTargetFallback>set in their project files
- projects communicating with Kentico Cloud endpoints need to use TLS1.2 or newer
The first three steps are very well described in Oren Novotny's blogpost. Unfortunately, most of the steps are manual as a migration tooling either doesn't exist or doesn't work well. (Yes, I can confirm that.) Anyway, switching to PackageReference and .NET Standard is definitely worth the labor.
Lastly, make sure your projects all use TLS1.2:
Read more details about TLS1.1 deprecation.
To save you some time configuring the projects, I've prepared a simple application with all the stuff in place. Check it out on GitHub: https://github.com/Kentico/cloud-sample-app-xamarin
After initializing a new Xamarin solution from a Visual Studio template, I removed the empty shared project and created a brand new .NET Standard 1.4 project called "Common". This project uses Kentico Delivery SDK to fetch some articles and displays them.
This is how it looks like on Android: