I am trying to write a simple oData client, which queries a Service hosted in MVC5/WebApi2. I am using the Simple.OData.Client component from Nuget (tried version 3 .0.0 and 3.3.0).
I have created a very basic C# Windows Forms app in VS2012 using the following code:
` var client = new ODataClient ("http://10.0.0.3:58298/odata/");
var customer = await client.For<Customer>().Key(11).FindEntryAsync();
lblSurname.Text = customer.Surname;`
Customer is a simple POCO class with a couple of properties - Surname and FirstName.
In the Windows Forms C# app, this works perfectly and the label displays the Surname as expected.
I then copied this code to a Xamarin Forms app in a PCL and ran it on an Android client (tried an emulator and a real device) and the call to FindEntryAsync() just hangs forever. I put some breakpoints in my OData service, but the OData service never even gets called, so this is happening before any data is returned.
I can open the URL in a browser on the Android emulator and see the data there, I have given the Android app "Internet" permissions.
I have tried changing the line to:
var customer = await client.For<Customer>().Key(11).FindEntryAsync().ConfigureAwait(false);
but this doesn't work either. What else do I need to do? In the Windows Forms app it works every time, what do I have to configure on Xamarin to make it work in Android?