public async Task SendMetricWhenAppLaunched(PushConfig pushConfig) { ILocalStore store = CreateChannelStore(); var pushIdentifier = store.Read(PUSH_ID_KEY); var client = CreateUPSHttpClient(pushConfig); await client.SendMetrics(pushIdentifier); store.Save(PUSH_ID_KEY, null); }
public async Task <string> Register(PushConfig pushConfig, IUPSHttpClient client) { Installation installation = CreateInstallation(pushConfig); ILocalStore store = CreateChannelStore(); string channelUri = await ChannelUri(); var token = pushConfig.VariantId + channelUri; if (!token.Equals(store.Read(CHANNEL_KEY))) { installation.deviceToken = channelUri; await client.Register(installation); store.Save(CHANNEL_KEY, token); } return(installation.deviceToken); }