Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • Push Notification in c#

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 69
    Comment on it

    In sending notifications to mobile device you need to write a code for it

     

    First you will create the events for that

    //Currently it will raise only for android devices
            static void DeviceSubscriptionChanged(object sender, 
            string oldSubscriptionId, string newSubscriptionId, INotification notification)
            {
                //Do something here
            }
    
            //this even raised when a notification is successfully sent
            static void NotificationSent(object sender, INotification notification)
            {
                //Do something here
            }
    
            //this is raised when a notification is failed due to some reason
            static void NotificationFailed(object sender, 
            INotification notification, Exception notificationFailureException)
            {
                //Do something here
            }
    
            //this is fired when there is exception is raised by the channel
            static void ChannelException
            	(object sender, IPushChannel channel, Exception exception)
            {
                //Do something here
            }
    
            //this is fired when there is exception is raised by the service
            static void ServiceException(object sender, Exception exception)
            {
                //Do something here
            }
    
            //this is raised when the particular device subscription is expired
            static void DeviceSubscriptionExpired(object sender, 
            string expiredDeviceSubscriptionId, 
            	DateTime timestamp, INotification notification)
            {
                //Do something here
            }
    
            //this is raised when the channel is destroyed
            static void ChannelDestroyed(object sender)
            {
                //Do something here
            }
    
            //this is raised when the channel is created
            static void ChannelCreated(object sender, IPushChannel pushChannel)
            {
                //Do something here
            }

    Then the events handler for associating to the events

    //create the puchbroker object
    var push = new PushBroker();
    //Wire up the events for all the services that the broker registers
    push.OnNotificationSent += NotificationSent;
    push.OnChannelException += ChannelException;
    push.OnServiceException += ServiceException;
    push.OnNotificationFailed += NotificationFailed;
    push.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired;
    push.OnDeviceSubscriptionChanged += DeviceSubscriptionChanged;
    push.OnChannelCreated += ChannelCreated;
    push.OnChannelDestroyed += ChannelDestroyed;

     

    .net

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: