public async Task Initialize() { if (isInitialized) return; var time = Xamarin.Insights.TrackTime("InitializeTime"); time.Start(); var handler = new AuthHandler(); //Create our client MobileService = new MobileServiceClient("https://mycoffeeapp.azurewebsites.net", handler); handler.Client = MobileService; if (!string.IsNullOrWhiteSpace (Settings.AuthToken) && !string.IsNullOrWhiteSpace (Settings.UserId)) { MobileService.CurrentUser = new MobileServiceUser (Settings.UserId); MobileService.CurrentUser.MobileServiceAuthenticationToken = Settings.AuthToken; } const string path = "syncstore.db"; //setup our local sqlite store and intialize our table var store = new MobileServiceSQLiteStore(path); store.DefineTable<CupOfCoffee>(); await MobileService.SyncContext.InitializeAsync(store, new MobileServiceSyncHandler()); //Get our sync table that will call out to azure coffeeTable = MobileService.GetSyncTable<CupOfCoffee>(); isInitialized = true; time.Stop(); }