示例#1
0
		public void sendViaConnection(APNSConnection connection)
		{
			if (tokenData == null) return;
			if (tokenData.Length != 32) return;

			SslStream stream = connection.getStream();

			stream.Write(command);
			stream.Write(commandBytes);

			stream.Write(tokenID);
			stream.Write(tokenSize);
			stream.Write(tokenData);

			stream.Write(messageID);
			stream.Write(messageSize);
			stream.Write(messageData);
		}
示例#2
0
        public static void sendNotification(List<MobileAppPushRegistration> registrations, string title, string content)
        {
            APNSConnection connection = new APNSConnection();
            connection.open();

            APNSAlert alert = new APNSAlert("New Notification", "You have a notification!");

            APNSMessage message = new APNSMessage();
            message.addAlert(alert);
            message.addSound("default");
            message.addCommand(3);

            APNSNotification notification = new APNSNotification(message, true);

            foreach (MobileAppPushRegistration registration in registrations)
            {
                notification.setDeviceToken(registration.RegistrationId);
                notification.sendViaConnection(connection);
            }

            connection.close();
        }
示例#3
0
        public static void sendNotification(List <MobileAppPushRegistration> registrations, string title, string content)
        {
            APNSConnection connection = new APNSConnection();

            connection.open();

            APNSAlert alert = new APNSAlert("New Notification", "You have a notification!");

            APNSMessage message = new APNSMessage();

            message.addAlert(alert);
            message.addSound("default");
            message.addCommand(3);

            APNSNotification notification = new APNSNotification(message, true);

            foreach (MobileAppPushRegistration registration in registrations)
            {
                notification.setDeviceToken(registration.RegistrationId);
                notification.sendViaConnection(connection);
            }

            connection.close();
        }
示例#4
0
        public void sendViaConnection(APNSConnection connection)
        {
            if (tokenData == null)
            {
                return;
            }
            if (tokenData.Length != 32)
            {
                return;
            }

            SslStream stream = connection.getStream();

            stream.Write(command);
            stream.Write(commandBytes);

            stream.Write(tokenID);
            stream.Write(tokenSize);
            stream.Write(tokenData);

            stream.Write(messageID);
            stream.Write(messageSize);
            stream.Write(messageData);
        }