A few days back, I saw this awesome video on Channel 9 by James Montemagno and learned about Microsoft Cognitive Services. The services are pretty awesome. Another awesome thing about these is that currently they are free (up to certain number of calls). The sample application which James showed in the video is in Xamarin Native. So, I thought to build the same application in Xamarin.Forms.

In this article, we will create a Xamarin.Forms mobile application which will use the following APIs of Microsoft Cognitive Services.

James' sample app uses 2 services. I added one more as some value adds.

Before starting the code, get Microsoft Cognitive Services API Keys (These steps may change if Microsoft updates its site).

Now, create a new Xamarin Forms project and follow the steps, given below.

As the code of the Application is a bit longer, I will only be sharing the main code snippets. Due to this, you won’t be able to execute the application if you only follow the steps and copy the code from this article. Rather, I would suggest you to read this article as an explanation of the associated code saved on my Github.

To add these, right click on the solution file and select ‘Manage NuGet Packages for solution‘ option from popup context menu.

This is how application looks on iPhone Simulator,

output

So, this is how we can use Microsoft Cognitive Services with Xamarin.Forms. Let me know if I have missed anything.