如何获取iOS设备的Azure通知中心RegistrationId?

时间:2019-01-31 16:29:16

标签: c# ios xamarin azure-notificationhub

我正在将Azure通知中心实施到跨平台Xamarin App中。我唯一地标识注册通知的每个设备的方式是通过临时存储azure分配给电话的RegistrationId。一旦用户登录,我就将RegstrationId和一些用户的独特特征发送到后端服务。 RegistrationId用于识别电话,然后将用户的详细信息作为标记通知的标签添加到该电话。

这可以在Android上使用,因为我要做的所有事情都需要获取以下registrationId:

var regID = hub.Register(token,tags.ToArray())。RegistrationId;

但是,由于SBNotificationHub类不包含任何获取RegistrationId的方法,因此iOS等效项不起作用。如何获取适用于iOS设备的Azure Azure注册ID?

谢谢。

1 个答案:

答案 0 :(得分:0)

我相信可以得到在static void Main(string[] args) { int height = 0; int peoplePlane = 0; int peopleShip = 0; string port = null; string Plane = "Plane"; string Car = "Avto"; string Ship = "Ship"; Console.WriteLine("Specify vehicle parameters:"); Console.WriteLine(new string('-', 10)); Welcome infoShowWelcome = new Welcome(); Vehicle TransportShow = new Vehicle(); Car ShowOne; Plane ShowTwo; Ship ShowThree; for (int i = 0; i <= 2; i++) { string nameTransport; if (i == 0) { nameTransport = Car; infoShowWelcome.ShowInfo(nameTransport); Car TransportOne = new Car(infoShowWelcome); ShowOne = TransportOne; } else if (i == 1) { nameTransport = Plane; infoShowWelcome.ShowInfo(nameTransport); Console.WriteLine("height" + " " + nameTransport + ":"); height = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("people" + " " + nameTransport + ":"); peoplePlane = Convert.ToInt32(Console.ReadLine()); Plane TransportTwo = new Plane(infoShowWelcome, height, peoplePlane); ShowTwo = TransportTwo; } else if (i == 2) { nameTransport = Ship; infoShowWelcome.ShowInfo(nameTransport); Console.WriteLine("port" + " " + nameTransport + ":"); port = Console.ReadLine(); Console.WriteLine("people" + " " + nameTransport + ":"); peopleShip = Convert.ToInt32(Console.ReadLine()); Ship TransportThree = new Ship(infoShowWelcome, port, peopleShip); ShowThree = TransportThree; } else { break; } ShowOne.ShowInfo(); ShowTwo.ShowInfo(); ShowThree.ShowInfo(); } Console.ReadKey(); } } 类在RegisteredForRemoteNotifications覆盖的装置ID作为在注意到this documentation

尝试将以下内容添加到您的AppDelegate类中:

AppDelegate

我认为deviceToken是您在iOS中寻找的东西?