Created
June 26, 2014 16:10
-
-
Save Cheesebaron/8526637abe418980a29a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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