Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>So from your comment I understand that it does work on your emulator but not on your phone right? Did you by any chance use the channel name in another/prior application?</p> <p>The thing is that the emulator reset back to it's default state everyime it closes, your phone does not. A particular channel name can only be used by a single application. So if the channel name was used by another application on the same phone before it is still registered to that app and you can't access it from your app. </p> <p>Conversely an app can also regsiter no more than one channel so if there is allready one by another name associated with it you cannot register a new one until you unregister the old one and <strong>reboot your device</strong>. Also there is no way to request which channel is associated with your app. </p> <p>Ultimately when I got stuck in this loop I changed the name of the channel and my applications ProductID registered in the WMAppManifest.xml and it worked again form me</p> <pre><code>&lt;App xmlns="" ProductID="{d57ef66e-f46c-4b48-ac47-22b1e924184b}" </code></pre> <p><strong>Update</strong> My computer crashed this weekend, thank god for WHS and backups. Anyway below is my sourcecode. I notice a two differences. </p> <ol> <li><p>First off I created a method called <code>RepeatAttemptExecuteMethod()</code> to which I pass the entire executing code as a delegate. The 10 floating somewhere at the end is the amount of times it has to retry. If you only retried the <code>.Open</code> method every 5 seconds the difference might be in that I also call the Find and New methods again...</p></li> <li><p>Another difference I see is that my code assumes that the _appChannel.ChannelUri can be null. In which case it waits for the channel to raise an event and then does the work asociated with a actual channel being there. But since your samplecode doesn't do any of that sort of work I doubt it will be what you are looking for</p> <pre><code>protected override void Load(PhoneApplicationPage parent) { Verkeer.Helper.ExternalResources.RepeatAttemptExecuteMethod(() =&gt; { _appChannel = HttpNotificationChannel.Find(CHANNELNAME); if (_appChannel == null) { _appChannel = new HttpNotificationChannel(CHANNELNAME); SetUpDelegates(); } else { SetUpDelegates(); //if (_appChannel.ChannelUri != null) this.NotificationChannel = _appChannel.ChannelUri; } if (_appChannel.ChannelUri != null) this.NotificationChannel = _appChannel.ChannelUri; else { try { _appChannel.Open(); } catch { } } BindToShellTile(); App.ViewModel.TrafficInfo.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(TrafficInfo_PropertyChanged); if (App.ViewModel.TrafficInfo.TrafficImage != null &amp;&amp; this.NotificationChannel != null) { CreateTiles(); } },10); } private void BindToShellTile() { if (!_appChannel.IsShellTileBound &amp;&amp; App.ViewModel.PanItemSettings.AutomaticallyUpdateTile) { Collection&lt;Uri&gt; ListOfAllowedDomains = new Collection&lt;Uri&gt; { new Uri("http://m.anwb.nl/") }; _appChannel.BindToShellTile(ListOfAllowedDomains); } } void TrafficInfo_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "TrafficImage") { if (App.ViewModel.PanItemSettings.AutomaticallyUpdateTile &amp;&amp; this.NotificationChannel != null) { CreateTiles(); } } } </code></pre></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload