Skip to content

Instantly share code, notes, and snippets.

@Cheesebaron
Created June 26, 2014 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cheesebaron/8526637abe418980a29a to your computer and use it in GitHub Desktop.
Save Cheesebaron/8526637abe418980a29a to your computer and use it in GitHub Desktop.
var registrationId = string.Empty;
var allRegistrations = await hubClient.GetAllRegistrationsAsync(10);
foreach (var registration in allRegistrations)
{
switch (deviceType)
{
case NotificationSubscriptionV1.DeviceTypes.Android:
{
var reg = registration as GcmRegistrationDescription;
if (reg != null)
{
if (reg.GcmRegistrationId.Equals(id))
registrationId = reg.RegistrationId;
}
}
break;
case NotificationSubscriptionV1.DeviceTypes.iOS:
{
var reg = registration as AppleRegistrationDescription;
if (reg != null)
{
if (reg.DeviceToken.Equals(id))
registrationId = reg.RegistrationId;
}
}
break;
case NotificationSubscriptionV1.DeviceTypes.Windows:
{
var reg = registration as WindowsRegistrationDescription;
if (reg != null)
{
if (reg.ChannelUri.ToString().Equals(id))
registrationId = reg.RegistrationId;
}
}
break;
case NotificationSubscriptionV1.DeviceTypes.WindowsPhone:
{
var reg = registration as MpnsRegistrationDescription;
if (reg != null)
{
if (reg.ChannelUri.ToString().Equals(id))
registrationId = reg.RegistrationId;
}
}
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment