private async Task HandleMessage(IMessageEvent message) { try { Log.Info("WearIntegration", "Received Message"); googleApiClient.Connect(); if (!googleApiClient.IsConnected) { Log.Info("WearIntegration", "Connecting"); } var authManager = ServiceContainer.Resolve <AuthManager> (); if (!authManager.IsAuthenticated) { Log.Info("WearIntegration", "Is not authenticated"); NotifyNotLoggedIn(); return; } var path = message.Path; try { if (path == Common.StartStopTimeEntryPath) { await WearDataProvider.StartStopTimeEntry(BaseContext); await UpdateSharedTimeEntryList(); } else if (path == Common.ContinueTimeEntryPath) { var guid = Guid.Parse(Common.GetString(message.GetData())); await StartEntry(guid); await UpdateSharedTimeEntryList(); } else if (path == Common.RequestSyncPath) { Log.Info("WearIntegration", "Sending sync data!"); await UpdateSharedTimeEntryList(); } else if (path == Common.OpenHandheldPath) { StartMainActivity(); } } catch (Exception e) { Log.Error("WearIntegration", e.ToString()); } } catch (Exception e) { Log.Error("WearIntegration", e.ToString()); } }
public async Task UpdateSharedTimeEntryList() { entryData = await WearDataProvider.GetTimeEntryData(); mapReq = PutDataMapRequest.Create(Common.TimeEntryListPath); currentDataMap = new List <DataMap> (); foreach (var entry in entryData) { currentDataMap.Add(entry.DataMap); } mapReq.DataMap.PutDataMapArrayList(Common.TimeEntryListKey, currentDataMap); await SendData(mapReq); }