Push notification channel gets closed after phone reboot

Category: windows phone push

Question

Abhishek Maity on Mon, 22 Jul 2013 08:45:01


I am creating notification channel as

HttpNotificationChannel channel = new HttpNotificationChannel("MyPushChannel");
                    channel.ShellToastNotificationReceived += channel_ShellToastNotificationReceived;
                    channel.ChannelUriUpdated += channel_ChannelUriUpdated;
                    channel.Open();
                    channel.BindToShellToast();

Now HttpNotificationChannel.Find("MyPushChannel") gives me the Push Channel I created, even after I restart the app. 

However, each time after phone restart, this method returns null.

Is it normal? Do I need to recreate my Push Channel every time after phone restart?

Replies

SMDWP on Mon, 22 Jul 2013 08:55:25


Hi,

Rather than create a new channel, you should use the Find method to find the channel, and create it if it doesn't exist, the following shows how this is achieved :-

http://msdn.microsoft.com/en-US/library/windowsphone/develop/hh202967%28v=vs.105%29.aspx

Hope this helps.

Paul Diston

Abhishek Maity on Mon, 22 Jul 2013 09:12:12


Yeah I read that.

I assumed that, after calling HttpNotificationChannel.Open(), until I call HttpNotificationChannel.Close(), I can always find the channel by calling HttpNotificationChannel.Find(channelName).

Can you please confirm that this is not the case after restart?

Thanks.

Eric Fleck on Thu, 01 Aug 2013 15:40:08


Are you testing on a physical phone or on the emulator?
I would expect this in the emulator because the emulator always starts using the snapshot created during setup.

For a physical phone the channel should persist across reboot as long as you have bound the channel for tile and/or toast notifications. (BindToShellTile, BindToShellToast)