I am creating an application with Azure integration, how much do I try to instantiate MobileServiceClient
I have the following exception
Method 'System.Net.Http.HttpClientHandler.set_AutomaticDecompression' not found.
Here is the definition of my class
public class AzureClient
{
private IMobileServiceClient _client;
private IMobileServiceSyncTable<Contact> _table;
private const string serviceUri = "http://{app}.azurewebsites.net/";
const string dbPath = "contactDb";
public AzureClient()
{
_client = new MobileServiceClient(serviceUri);
var store = new MobileServiceSQLiteStore(dbPath);
store.DefineTable<Contact>();
_client.SyncContext.InitializeAsync(store);
_table = _client.GetSyncTable<Contact>();
}
public async Task<IEnumerable<Contact>> GetContacts()
{
var empty = new Contact[0];
try
{
if (Plugin.Connectivity.CrossConnectivity.Current.IsConnected)
await SyncAsync();
return await _table.ToEnumerableAsync();
}
catch (Exception)
{
return empty;
}
}
public async void AddContact(Contact contact)
{
await _table.InsertAsync(contact);
}
public async Task SyncAsync()
{
ReadOnlyCollection<MobileServiceTableOperationError> syncErrors = null;
try
{
await _client.SyncContext.PushAsync();
await _table.PullAsync("allContacts", _table.CreateQuery());
}
catch (MobileServicePushFailedException pushEx)
{
if (pushEx.PushResult != null)
syncErrors = pushEx.PushResult.Errors;
}
}
public async Task CleanData ()
{
await _table.PurgeAsync("allContacts", _table.CreateQuery(), new System.Threading.CancellationToken());
}
}
The error happens when I try to run the project for Android. The complete source code for the project can be found in my github